leftshift / python_mvg_api

Yet another library for fetching MVG departures.
https://pypi.org/project/mvg-api/
MIT License
65 stars 18 forks source link

Updated a sanity check function for new format of station ids. #16

Closed Bastlwastl42 closed 4 years ago

Bastlwastl42 commented 4 years ago

I added a sanity check function for the new station id format as mentioned/proposed in issue #15

leftshift commented 4 years ago

Hey, thanks for the issue and pull request, much appreciated :)

I'd like to keep backwards compatibility for using old-style integer IDs in get_routes() and get_departures(). Let's just check for int there and use a helper function to prepend the new id prefix, as the last part of the new IDs seem to be the old IDs.

Also, we should update the docstrings for get_locations() and get_nearby_stations() to reflect these new IDs in the station objects.

If you don't have time to make these changes, I can fit them in some time this evening, as I'd like to release this as soon as I can.

Bastlwastl42 commented 4 years ago

Hey,

Having the ID split and stored separately sounds like a good idea. I also have the impression that the new format is :<Citycode?>: but this needs to be verified. I won't have time to work on this until this weekend for sure, so if you can go ahead and then deploy, that would be much appreciated as well :)

leftshift commented 4 years ago

I wouldn't necessarily split the new IDs but I'd like to have some mechanism to silently convert old IDs to new IDs to remain backwards compatible.

Yeah, I'm also curious about the new ID format, I'll see whether I can find something about that. It looks like they are switching to universally unique station IDs, maybe there's some standard or oganisation for assigning those prefixes.

Great, I'll take care of it later then. :)