定义模块级导入。
PyRMVtransport的Python项目详细描述
PymvTransport:总线:
使用来自opendata.rmv.de的传输信息的python库。
安装
$ pip install PyRMVtransport
用法
importasyncioimportaiohttpfromRMVtransportimportRMVtransportasyncdefmain():"""The main part of the example script."""asyncwithaiohttp.ClientSession()assession:rmv=RMVtransport(session)# Get the datatry:# Departures for station 3006907 (Wiesbaden Hauptbahnhof)# max. 5 results# only specified products (S-Bahn, U-Bahn, Tram)data=awaitrmv.get_departures(station_id='3006907',products=['S','U-Bahn','Tram'],max_journeys=5)# Use the JSON outputprint(data)# or pretty printawaitrmv.output()exceptTypeError:passloop=asyncio.get_event_loop()loop.run_until_complete(main())