flight_scraper
flight_scraper copied to clipboard
No JSON object could be decoded
Hi, I am checking your app, I think is very interesting. But I have the following issue when I try to search flights. When web_app.py
is correctly running, I set up a valid search in ITA Matrix and the webapp sends me the error below. Could you provide me some support to solve this error?
Thanks
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Library/Python/2.7/site-packages/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Library/Python/2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Library/Python/2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/jimenezster/workspaces/flight_scraper/web_app.py", line 74, in flight_query
v = [d[0].isoformat(), d[1].isoformat(), flight_scraper.search_flights()]
File "/Users/jimenezster/workspaces/flight_scraper/flight_scraper/scraper.py", line 19, in search_flights
return ita_driver.build_solutions()
File "/Users/jimenezster/workspaces/flight_scraper/flight_scraper/engines/ita_matrix/driver.py", line 82, in build_solutions
response_json = json.loads(response.text[4:])
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 326, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 360, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 378, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
Unfortunately, the ITA Matrix protocol I was using was changed after the Google takeover. They are now pushing the following: https://developers.google.com/qpx-express/
It should be possible to integrate the QPX service to this and make use of the free queries.