Skip to content

Commit

Permalink
Merge pull request #5 from becheran/dev
Browse files Browse the repository at this point in the history
removed "all_stations" function due no support by VGN anymore
  • Loading branch information
alex-jung authored Oct 30, 2024
2 parents 1c52b37 + 0013016 commit 26b3beb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 20 deletions.
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,15 @@ async def main():
async with vgn.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(vgn.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]}')
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())
Expand Down
17 changes: 3 additions & 14 deletions vgn/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ async def api_version(self) -> str:
query = self._url('haltestellen/VGN/location?lon=0&lat=0')
return (await self._get(query)).get('Metadata').get('Version')

async def all_stations(self) -> List[Station]:
""" List of all stations.
Returns:
list: List of stations for the VGN transport association.
"""
query = self._url(f'haltestellen/VGN')
return conv.to_stations((await self._get(query)).get('Haltestellen'))

async def stations(self, station_name: str) -> List[Station]:
""" List of stations for the specified station name.
Expand Down Expand Up @@ -177,16 +168,14 @@ 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]}')
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__':
Expand Down
2 changes: 1 addition & 1 deletion vgn/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@pytest.mark.asyncio
async def test_api_version_did_not_change():
async with VGNClient() as vgn_client:
assert (await vgn_client.api_version()) == 'Puls-API-v1.2'
assert (await vgn_client.api_version()) == 'Puls-API-v1.2.3'


@pytest.mark.asyncio
Expand Down

0 comments on commit 26b3beb

Please sign in to comment.