slimkrazy/python-google-places

BUG found in nearby_search with radius parameter

javier-fiore opened this issue · 2 comments

When you complete radius parameter with a value less than 50000, for example, 500, the operator is wrong and you ever use, 50000.

You must change this:
radius = (radius if radius <= GooglePlaces.MAXIMUM_SEARCH_RADIUS
else GooglePlaces.MAXIMUM_SEARCH_RADIUS)

for this:
radius = (radius if radius >= GooglePlaces.MAXIMUM_SEARCH_RADIUS
else GooglePlaces.MAXIMUM_SEARCH_RADIUS)

line: 277 in init.py

Please feel free to submit a pull request!

Hey @javier-fiore - I'm just sat on a train looking at this ticket properly. You are mistaken I'm afraid. This is no bug, the logic seems correct to me:

radius = (radius if radius <= GooglePlaces.MAXIMUM_SEARCH_RADIUS
else GooglePlaces.MAXIMUM_SEARCH_RADIUS)

Radius will equal the input IF the input is less than the maximum, otherwise it will be set to the maximum.