Warsaw data python api
Project description
Pythonic way to use Warsaw data API
This package allow to fetch data from API provided by "UM Warszawa" - https://api.um.warszawa.pl/
Current features
- Fetch ZTM buses and trams real-time location
- Fetch Schedule for bus stop for certain bus line
Getting Started
Installation
pip install warsaw-data-api
Using ZTM module
Get buses/trams locations:
We can fetch all location data for buses:
import warsaw_data_api
ztm = warsaw_data_api.client('ztm', apikey='your_api_key')
buses = ztm.get_buses_location()
for bus in buses:
print(bus)
We can do the same for trams, as a parameter we can set number of tram line
import warsaw_data_api
ztm = warsaw_data_api.client('ztm', apikey='your_api_key')
trams = ztm.get_trams_location(line=17)
for tram in trams:
print(tram)
Get buses schedule:
We can fetch schedule by using bus stop id:
import warsaw_data_api
ztm = warsaw_data_api.client('ztm', apikey='your_api_key')
schedule = ztm.get_bus_stop_schedule_by_id(7009, "01", "182")
print(schedule)
or we can fetch it by using bus stop name:
import warsaw_data_api
ztm = warsaw_data_api.client('ztm', apikey='your_api_key')
schedule = ztm.get_bus_stop_schedule_by_name("Marszałkowska", "01", "182")
print(schedule)
Passing API Key
We can pass API Key in two different ways:
- Pass API Key to client function as a parameter
ztm = warsaw_data_api.client('ztm', apikey='your_api_key')
- Create environment variable called
WARSAW_DATA_API_KEY
Running tests:
- Go to root directory
- Install packages:
pip install -r requirements.txt
- Run tests:
python -m unittest
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
warsaw-data-api-0.2.0.tar.gz
(5.0 kB
view details)
Built Distribution
File details
Details for the file warsaw-data-api-0.2.0.tar.gz
.
File metadata
- Download URL: warsaw-data-api-0.2.0.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 65971a82308429da929cba6c5df8ab4a94f90c1972c908e948a527d97bc16f67 |
|
MD5 | ab5a5ade927d0813a4fe2f2493583405 |
|
BLAKE2b-256 | 8d711aa6e8b3f1801e8ebd35a6606eed54f1cc5ea43e1d4c10bfb625f3cd6e1a |
File details
Details for the file warsaw_data_api-0.2.0-py2.py3-none-any.whl
.
File metadata
- Download URL: warsaw_data_api-0.2.0-py2.py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa706d7e2d164423e5c1f627e62feb5cc3b54dc4699b4236d50bf1b14e53ab35 |
|
MD5 | 74b7a332b578722bd74fa05a90dd5bf0 |
|
BLAKE2b-256 | 806bb38aaa938c827eef9aa4dc8a92f4271c934ba2fc41deb1e40fd0660ee517 |