Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List index out of range error for google directions #15

Closed
alichass opened this issue Oct 4, 2020 · 3 comments · Fixed by #27
Closed

List index out of range error for google directions #15

alichass opened this issue Oct 4, 2020 · 3 comments · Fixed by #27

Comments

@alichass
Copy link
Contributor

alichass commented Oct 4, 2020

Here's what I did (dry run output):

url:
https://maps.googleapis.com/maps/api/directions/json?departure_time=1602059400&destination=37.42306%2C-122.08413&key=####################&mode=transit&origin=37.26044%2C-122.11921&units=metric
Parameters:
{
"headers": {
"User-Agent": "routingpy/v0.3.2",
"Content-Type": "application/json"
},
"timeout": 60
}


Here's what I got

image

Seems to be cause by this repsonse:
{'available_travel_modes': ['DRIVING', 'WALKING', 'BICYCLING'], 'geocoded_waypoints': [{}, {}], 'routes': [], 'status': 'ZERO_RESULTS'}


Here's what I was expecting

Empty direction object if response is:
{'available_travel_modes': ['DRIVING', 'WALKING', 'BICYCLING'], 'geocoded_waypoints': [{}, {}], 'routes': [], 'status': 'ZERO_RESULTS'}

@nilsnolde
Copy link
Owner

What I'd expect from a well-behaved API is a 404.. Or any 4xx, which is what would prevent smth like that. But google maps 🤷

@nilsnolde
Copy link
Owner

I guess we should still handle it (eventually anyways;)), even if Google is being idiot here..

@nilsnolde nilsnolde reopened this Nov 17, 2020
@alichass
Copy link
Contributor Author

There's another really weird unrelated (unsure if its google specific, likely is) edge case, where requesting a walk or car route can sometimes result in a route with a ferry step

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants