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.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:

  1. Pass API Key to client function as a parameter ztm = warsaw_data_api.client('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.2.1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

warsaw_data_api-0.2.1-py2.py3-none-any.whl (6.3 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: warsaw-data-api-0.2.1.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

Hashes for warsaw-data-api-0.2.1.tar.gz
Algorithm Hash digest
SHA256 753a39f4c219f510cb24f2cdcab72b1eb3c7996fc6bae1f41578eef3d046e8b5
MD5 8ca81c6928b3164e67cf559bb190250d
BLAKE2b-256 dc9ad2bf6c334e2cd1bc23b7295009b148edb2408f7207ddab60ccba28240bb0

See more details on using hashes here.

File details

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

File metadata

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

Hashes for warsaw_data_api-0.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f007f5088187e8f021845f131ef690fead1dcc3ec9f6d77f90324b8b23e4f94c
MD5 c5ccc207a10e1b35984dd5f72df58e8f
BLAKE2b-256 39d1472ed665e307e2e039ffa045ec625b7d9308d43b649523281e0763eae8fb

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