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.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.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.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.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 factory function (
ztm()
in this case) as a parameterztm = warsaw_data_api.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.3.3.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file warsaw_data_api-0.3.3.tar.gz
.
File metadata
- Download URL: warsaw_data_api-0.3.3.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.30.0 requests-toolbelt/1.0.0 urllib3/2.0.2 tqdm/4.65.0 importlib-metadata/6.6.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38b7dca47977ee2823dc920b34584599b885c1f3a9282e4a088d8acf5e65be60 |
|
MD5 | 0bb6a43c534a1af573dc9e971d886324 |
|
BLAKE2b-256 | ba079f2ce375e1ee0d40824795d5f512534bafe77ce5ec05b48d7ece7abbfbbe |
File details
Details for the file warsaw_data_api-0.3.3-py3-none-any.whl
.
File metadata
- Download URL: warsaw_data_api-0.3.3-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/37.3 requests/2.30.0 requests-toolbelt/1.0.0 urllib3/2.0.2 tqdm/4.65.0 importlib-metadata/6.6.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2521cabf092e268fe4ea19e4b6273f783a8aef3f00825a1b6dbd322ea78a3233 |
|
MD5 | 15d0d04d9dc768c6a9e325149697c4d8 |
|
BLAKE2b-256 | 46c880f27c3e54bc7f56878a68f7dd469170d4be778f2f98c315f9ab3ae72aff |