Skip to main content

VGN async API for python 3

Project description

VGN

License Version PyPI download month Python versions Documentation Status Build Status

Asynchron Python API for the Verkehrsverbund Grossraum Nuernberg (VGN).

Uses the official REST-API to query realtime public transport information for Nuremberg.

With the python 3.7 feature asyncio tasks fast and non-blocking querries are possible.

Read the docs for more information.

Consider installing cchardet and aiodns via pip for speedup (see the aiohttp documentation).

Example

import vgn
import asyncio


async def main():
    async with VGNClient() as vgn_client:
        res = await asyncio.gather(
            vgn_client.api_version(),
            vgn_client.all_stations(),
            vgn_client.departure_schedule(704),
            vgn_client.departure_schedule_for_line(704, "U2"),
            vgn_client.rides(TransportType.BUS, 30),
        )

    print(f'Api version: {res[0]}')
    print(f'Stations in nbg: {str(len(res[1]))}')
    print(f'Departures at plaerrer in nbg: {res[2]}')
    print(f'Departures of underground line 2 at plaerrer in nbg: {res[3]}')
    print(f'Bus departures in the next 30 minutes: {res[4]}')

if __name__ == '__main__':
    asyncio.run(main())

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

vgn-2.0.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

vgn-2.0.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file vgn-2.0.0.tar.gz.

File metadata

  • Download URL: vgn-2.0.0.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for vgn-2.0.0.tar.gz
Algorithm Hash digest
SHA256 18d515cf936a4ddb0fb8b7bc7797fd6c873262480007254e5c91754d58d79465
MD5 2da433c285e912645d6c1fd4f86e1e07
BLAKE2b-256 94fe6d8ab0efc363b2e2846f3cfc868c55f63c6d6f6d51df28dd91cecb8312da

See more details on using hashes here.

File details

Details for the file vgn-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: vgn-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

File hashes

Hashes for vgn-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8eddbe76f1933051a3414ed4ff15a77723ca1831bcfd9a0848fa3b77d714aae8
MD5 5939868e7156e79e2adcb3954d072103
BLAKE2b-256 4e5f7e64bad36070b292a949ec9ca2a691c593276d0a52eccd3557b1894be842

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