[go: nahoru, domu]

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

Error in speed_limits method #190

Closed
mahimranjan opened this issue Aug 17, 2017 · 4 comments
Closed

Error in speed_limits method #190

mahimranjan opened this issue Aug 17, 2017 · 4 comments

Comments

@mahimranjan
Copy link

Hi,

I'm getting this error when trying to use the speed_limits method:

Traceback (most recent call last):
File "testurl.py", line 38, in
speed_lim = gmaps.speed_limits("ChIJVQcunKIA3IAReSI1GXlR1Yk")
File "/Library/Python/2.7/site-packages/googlemaps/client.py", line 356, in wrapper
result = func(*args, **kwargs)
File "/Library/Python/2.7/site-packages/googlemaps/roads.py", line 95, in speed_limits
extract_body=_roads_extract)["speedLimits"]
KeyError: 'speedLimits'

I think I'm making the call correctly. Here is how I'm calling it:
speed_lim = gmaps.speed_limits("ChIJVQcunKIA3IAReSI1GXlR1Yk")

Everything else (directions) seems to be working fine.

Thanks

@stephenmcd
Copy link
Contributor

Looks like you're using a place ID that doesn't have a corresponding speed limit, eg here's a valid one:

https://roads.googleapis.com/v1/speedLimits?placeId=ChIJLQcticc0GQ0RoiNZJVa5GxU&key=YOUR_KEY

@mahimranjan
Copy link
Author

Oh wow. Just my luck that the first street I tried doesn't have speed limits in Google database!

Surprising, this is a major interstate freeway.

@mahimranjan
Copy link
Author

Should this really error out? I can deal with this with a try/except clause, but it doesn't seem right that this should error out like this.

Maybe add a check in the library and return a success/failure flag?

@stephenmcd
Copy link
Contributor

You're right, I fixed that in de0ddab

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

No branches or pull requests

2 participants