Skip to main content

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:

  1. Pass API Key to factory function (ztm() in this case) as a parameter ztm = warsaw_data_api.ztm(apikey='your_api_key')
  2. Create environment variable called WARSAW_DATA_API_KEY

Running tests:

  1. Go to root directory
  2. Install packages:
pip install -r requirements.txt
  1. Run tests:
python -m unittest

Project details


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.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

warsaw_data_api-0.3.0-py2.py3-none-any.whl (5.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file warsaw-data-api-0.3.0.tar.gz.

File metadata

  • Download URL: warsaw-data-api-0.3.0.tar.gz
  • Upload date:
  • Size: 4.8 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

Hashes for warsaw-data-api-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b75e975d605bd5698592b2354169911ead190e56584a00f5d98da5cad3d4b380
MD5 863c753b52a51e1c0ddcfa99f2f111f8
BLAKE2b-256 6c706c1253a03d8ad6b4c4e2c5d13c89b7a299a6b154adae923889444490ac89

See more details on using hashes here.

File details

Details for the file warsaw_data_api-0.3.0-py2.py3-none-any.whl.

File metadata

  • Download URL: warsaw_data_api-0.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.9 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

Hashes for warsaw_data_api-0.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 eba1b886907cef15c9472922e9cb55de0272de1130abdff8bf02ad90fe11cd5b
MD5 e2be21d93a13450c541faf8f50989672
BLAKE2b-256 44d22517068cbac9abf7f422477194ac80cd190c9405a2b2fae76220f32accbb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page