Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bahnpark v2.3 converter #2

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Add bahnpark v2.3 converter #2

wants to merge 3 commits into from

Conversation

hbruch
Copy link
Collaborator

@hbruch hbruch commented Oct 9, 2023

This PR adds a converter for DB Bahnpark API 2.3.x.

Note that it requires #1 to be merged.

Note also, that the rate limits imposed bei the Bahnpark imply that this converter can not be used with DB Bahnpark's usual test access.

hbruch added 3 commits October 9, 2023 12:31
Note: there is no occupancies endpoint anymore with v2,
and db bahnpark imposes heavy rate limits, so the
usability of this scraper is fairly limited without increased
limits
...and don't call get_lot_data for realtime
@hbruch hbruch requested a review from the-infinity October 9, 2023 10:44
@hbruch hbruch marked this pull request as draft October 9, 2023 10:44
- or in a `.env` file in the root of the scraper package containing: `BAHN_API_TOKEN=xxx`
This scraper is disabled unless you define your DB credentials, either in
- environment: e.g. `export DB_CLIENT_ID=xxx && export DB_API_KEY=yyy` before running the scraper
- or in a `.env` file in the root of the scraper package containing: `DB_CLIENT_ID=xxx DB_API_KEY=yyy`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? Or does it have to be two separate lines DB_CLIENT_ID=xxx & DB_API_KEY=yyy?

warnings.warn(
"Deutsche Bahn Parking API disabled! "
"You need to define BAHN_API_TOKEN in environment or in a .env file"
"You need to define DB_CLIENT_ID and DB_API_KEY in environment or in a .env file"
)

else:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script cannot function without $DB_CLIENT_ID & $DB_API_KEY, right?

If that is the case, I recommend aborting (exiting the process) with a non-0 status code, so that the calling script/user can react accordingly. Also, from the warnings.warn() docs (emphasis mine):

Warning messages are typically issued in situations where it is useful to alert the user of some condition in a program, where that condition (normally) doesn’t warrant raising an exception and terminating the program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants