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

Uploaded Source

Built Distribution

warsaw_data_api-0.3.1-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.1.tar.gz.

File metadata

  • Download URL: warsaw_data_api-0.3.1.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

Hashes for warsaw_data_api-0.3.1.tar.gz
Algorithm Hash digest
SHA256 8201127f7068d0b49dc4d5e447421a9e3ab02644bb790cd8877c565c8ae962c5
MD5 acef3504ad31e347f886cc3fc226d7ba
BLAKE2b-256 d4161b42aaf9682d4a22e21037a5609f8292667b43130fb143cfe3920f411e93

See more details on using hashes here.

File details

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

File metadata

  • Download URL: warsaw_data_api-0.3.1-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.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

Hashes for warsaw_data_api-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3487ff707bfd1672f4abae514038891f505920d5cc72c364b43f5f2250a76463
MD5 b31d6c7cd93ae961c63e37180c8dc6b5
BLAKE2b-256 dc320737e083bf28fc4a753dd5aae06a4306f929c61db70f79903e84d2761845

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