-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
28 lines (19 loc) · 721 Bytes
/
example.py
File metadata and controls
28 lines (19 loc) · 721 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""
Copyright (c) 2015-2018 Fabian Affolter <fabian@affolter-engineering.ch>
Licensed under MIT. All rights reserved.
"""
import asyncio
import aiohttp
from opendata_transport import OpendataTransport
async def main():
with aiohttp.ClientSession() as session:
data = OpendataTransport('Bex', 'Vevey', loop, session)
await data.async_get_data()
# Print the start and the destination name
print("Train connections:", data.from_name, "->", data.to_name)
# Print the next three connections
print(data.connections)
# Print the details of the next connection
print(data.connections[0])
loop = asyncio.get_event_loop()
loop.run_until_complete(main())