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

Uploaded Source

Built Distribution

warsaw_data_api-0.3.2-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.2.tar.gz.

File metadata

  • Download URL: warsaw_data_api-0.3.2.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.2.tar.gz
Algorithm Hash digest
SHA256 8413f08dba88386aeb6e2c761c91d79fd903b52d2fbdf6a197ab0acb2b1bcfa9
MD5 d0717502254f41cde2f15116cc8028cb
BLAKE2b-256 cc961a28af557615ee26d4f86058545ce80ea02807e831c844c08171cdbf2875

See more details on using hashes here.

File details

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

File metadata

  • Download URL: warsaw_data_api-0.3.2-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.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 53f8f7d47577bf395e95ed2bb23f10c0df57660aa3c4208a9dae14091fbadddf
MD5 37c9f3b7147e9611ead980b2ebeb33d5
BLAKE2b-256 1c7eb80627e0750ec2b962680e250de0418d29b70f2a3a3f8b97307977ad06c9

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