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') # you can get API KEY on the https://api.um.warszawa.pl/ after you register
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.rides)
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.rides)
if you would like to retrieve all buses for the bus stop you can use this:
import warsaw_data_api
ztm = warsaw_data_api.ztm(apikey='your_api_key')
lines = ztm.get_lines_for_bus_stop_id("7009", "01")
print(lines)
You can also retrieve bus stop id by passing bus stop name:
import warsaw_data_api
ztm = warsaw_data_api.ztm(apikey='your_api_key')
bus_stop_id = ztm.get_bus_stop_id_by_bus_stop_name("Marszałkowska")
print(bus_stop_id)
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
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file warsaw_data_api-0.5.3.tar.gz.
File metadata
- Download URL: warsaw_data_api-0.5.3.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b66e87084f1d7d2f05f48b65046033c5f0a8417dba96d52b2ffa00953c268ae
|
|
| MD5 |
10c651b455ae0469e4dc0615fd30b310
|
|
| BLAKE2b-256 |
edafd4b5f1a6f043fb7c08a32bcfcb21fd878e8ff784b194a080ddf09d0e546f
|
File details
Details for the file warsaw_data_api-0.5.3-py3-none-any.whl.
File metadata
- Download URL: warsaw_data_api-0.5.3-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ff0920d06b0deff028b2df1e81d723c30ba994960b8ef062f1b480881a5a0426
|
|
| MD5 |
57814bd0af8d1c58d19223e28e89b02b
|
|
| BLAKE2b-256 |
969a4b0d186782f80417de8c0affb2444f324b4d266ed45b0ed3c6bd294b0497
|