Skip to content

becheran/vgn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VGN

License Version PyPI download month Python versions Documentation Status Build Status

Asynchronous 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 queries 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 vgn.VGNClient() as vgn_client:
        res = await asyncio.gather(
            vgn_client.api_version(),
            vgn_client.departure_schedule(704),
            vgn_client.departure_schedule_for_line(704, "U2"),
            vgn_client.rides(vgn.TransportType.BUS, 30),
        )

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

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

About

Python API for the Verkehrsverbund Grossraum Nuernberg (VGN)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages