dsbuntis 7.0.0-alpha.3 copy "dsbuntis: ^7.0.0-alpha.3" to clipboard
dsbuntis: ^7.0.0-alpha.3 copied to clipboard

outdated

This package allows you to crawl the DSB/DSBMobile API and parse Untis's HTML.

dsbuntis #

pub points coverage

This package allows you to crawl DSB's "Mobile API" and parse Untis's HTML.

Usage #

For a basic example on how to get your substitutions, please refer to the example.

Lower-level APIs (Session) #

getAllSubs only accounts for the most basic usage. For a more customizable experience, you'll want to use the Session API.

Sessions are created in two ways: Logging in or using an existing token.

To log in, you call Session.login:

final session = await Session.login('187801', 'public');

To use an existing token, you previously (6.1) used Session.fromToken. Now, the Session constructor allows for passing them:

final session = Session('13ccccbb-e6a8-466a-addc-00bba830c6cf');

Then you can get the JSON with timetable information:

final ttJson = await session.getTimetableJson();

And download and parse the plans:

final downloadingPlans = session.downloadPlans(ttJson);
final plans = await session.parsePlans(downloadingPlans);

Caching and best practices #

A very important feature in dsbuntis from the beginning has been good caching. For documentation on how to set it up for the actual requests, please refer to the schttp documentation, as it is the HTTP backend of dsbuntis. From version 6 on, however, you can aditionally cache Sessions. AFAIK the login of DSBMobile is idempotent (as indicated by it being a GET request) and always returns the same token. (don't assume this is true yet) If it is, you can cache the Session's token forever. If it isn't, you can still cache the Session object.

4
likes
0
pub points
24%
popularity

Publisher

verified publisherampless.chrissx.de

This package allows you to crawl the DSB/DSBMobile API and parse Untis's HTML.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

html, html_search, html_unescape, schttp

More

Packages that depend on dsbuntis