dsb 0.1.0-alpha.2 copy "dsb: ^0.1.0-alpha.2" to clipboard
dsb: ^0.1.0-alpha.2 copied to clipboard

outdated

This package allows you to crawl the DSB/DSBMobile API.

dsb #

pub points

This package allows you to crawl DSB's "Mobile API".

Usage #

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, 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();

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 our HTTP backend. 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. If it is, which you can safely assume by now, you can cache the Session's token forever. Otherwise you can still keep the Session object around for a while.

0
likes
0
pub points
0%
popularity

Publisher

verified publisherampless.chrissx.de

This package allows you to crawl the DSB/DSBMobile API.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

schttp

More

Packages that depend on dsb