-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: master
Are you sure you want to change the base?
Conversation
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
- 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` |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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.
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.