telegram-uz-bot
telegram-uz-bot copied to clipboard
Add better date validation
Task exception was never retrieved
future: <Task finished coro=<UZScanner.scan() done, defined at /usr/src/app/uz/scanner.py:109> exception=ResponseError('status code: 200, request data: {\'another_ec\': 0, \'station_id_from\': \'2200001\', \'time_dep\': \'00:00\', \'search\': \'\', \'station_id_till\': \'2218000\', \'date_dep\': \'01.01.2016\', \'time_dep_till\': \'\'}, response body: b\'{"value":"You have entered invalid date","error":true,"data":null,"captcha":null}\'',)>
Traceback (most recent call last):
File "/usr/local/lib/python3.5/asyncio/tasks.py", line 239, in _step
result = coro.send(None)
File "/usr/src/app/uz/scanner.py", line 117, in scan
data['date'], data['source'], data['destination'], data['train_num'])
File "/usr/src/app/uz/client/client.py", line 119, in fetch_train
trains = await self.list_trains(date, source_station, destination_station)
File "/usr/src/app/uz/client/client.py", line 115, in list_trains
result = await self.call('purchase/search/', data=data)
File "/usr/src/app/uz/client/client.py", line 94, in call
raise ResponseError(response.status, body, kwargs.get('data'), json)
uz.client.exceptions.ResponseError: status code: 200, request data: {'another_ec': 0, 'station_id_from': '2200001', 'time_dep': '00:00', 'search': '', 'station_id_till': '2218000', 'date_dep': '01.01.2016', 'time_dep_till': ''}, response body: b'{"value":"You have entered invalid date","error":true,"data":null,"captcha":null}'