dsbuntis 8.1.0-alpha.4 copy "dsbuntis: ^8.1.0-alpha.4" to clipboard
dsbuntis: ^8.1.0-alpha.4 copied to clipboard

Crawl the DSB/DSBMobile API and parse Untis's HTML.

dsbuntis #

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

Usage #

The one-stop function provided by this package is getAllSubs. You can call it like this:

final plans = await getAllSubs('187801', 'public');

Lower-level APIs #

For everything more advanced than the optional arguments of getAllSubs, you will have to reach into the lower-level APIs of the dsb and untis packages. Please consult their documentation for details.

To log in, you call Session.login:

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

To use an existing token, you pass it to the Session constructor:

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

Then you can get the timetable information:

final timetables = await session.getTimetables();

And download and parse the plans, with the extension provided by this package:

final plans = await session.downloadAndParsePlans(timetables);

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. In recent versions, however, you can aditionally cache the Session objects from dsb. The "login" of DSBMobile is idempotent (as indicated by it being a GET request) and always returns the same token. Therefore, you can cache the Session's token "forever".

4
likes
140
points
27
downloads

Publisher

verified publisherampless.chrissx.de

Weekly Downloads

Crawl the DSB/DSBMobile API and parse Untis's HTML.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MPL-2.0 (license)

Dependencies

dsb, schttp, untis, where_not_null

More

Packages that depend on dsbuntis