access public transport information in hamburg, germany.
Project description
HVV Geofox Python Library
About
This library is a python wrapper for accessing the geofox api. This api is used to get information about the public transport in Hamburg, Germany.
How to get the api credentials
You have to apply for credentials via the HVV website. You can see their official guide here (the page is only available in German).
They will send you a contract you will have to sign and send back. After about a week, you will receive your api credentials.
Documentation
This library uses the same data types and parameters as specified in the GTI documentation. It features client side validation of the parameters.
Installation
Install the package from pypi.
pip install pygti
Usage
See the examples on how to use the library at examples.py, and see the GTI documentation for in-depth explanation of parameters.
There is also a Glitch example available. Try it out and if you want to see how it's done, just remix the app.
A minimal working example is shown below:
from pygti.gti import GTI, Auth
import asyncio
import aiohttp
GTI_USER = "" # your api username
GTI_PASS = "" # your api password
async def main():
async with aiohttp.ClientSession() as session:
auth = Auth(session, GTI_USER, GTI_PASS)
gti = GTI(auth)
ir = await gti.init()
# see the examples.py file for more functionality and use of the payloads
asyncio.run(main())
:exclamation: If using Python 3.8: Version 3.6.2 of aiohttp uses a different EventLoopPolicy so running this MWE will currently result in an error displayed in the console! It should not affect the functionality. This should be fixed with a newer version of aiohttp. For a workaround look into the examples.py file. For more information see this Issue.
Progress
- 1. init
- 2. checkName
- 3. getRoute
- 4. departureList
- 5. getTariff
- 6. departureCourse
- 7. listStations
- 8. listLines
- 9. getAnnouncements
- 10. getIndividualRoute
- 11a. getVehicleMap
- 11b. getTrackCoordinates
- 12. checkPostalCode
- 13. getStationInformation
- 14. tariffZoneNeighbours
- 15. tariffMetaData
- 16. singleTicketOptimizer
- 17. ticketList
Developing
Some files in this project are generated based on the WADL and XSD schema files from GTI. To generate them, install the dev dependencies and run the script:
pip install -r requirements_dev.txt
python script/generate.py
Contributions are welcome!
If you want to contribute to this, please read the Contribution guidelines
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pygti-0.9.4.tar.gz
.
File metadata
- Download URL: pygti-0.9.4.tar.gz
- Upload date:
- Size: 44.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cfb9497a9eda774ec10fd6015188006eafdf8000a17726c28bb8e1838d4b0ea |
|
MD5 | 25da6950e6ee1b65b9358e9413d2e156 |
|
BLAKE2b-256 | 34e93f11bff4bb9b48be80d65868edc0c1d5461c13b8234d42e8368090a65ec6 |
File details
Details for the file pygti-0.9.4-py2.py3-none-any.whl
.
File metadata
- Download URL: pygti-0.9.4-py2.py3-none-any.whl
- Upload date:
- Size: 29.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1eb4b26bc6cc2d637a5ea116650f197612a55cc3a62c3b408874db366f561741 |
|
MD5 | a0f2b7854c9b8c25afadfbf592f23c88 |
|
BLAKE2b-256 | 1b5918b626bbe94638dff478e300ff32f49e6820380ead8021ff3258f1f6d98e |