Reputation: 59
I have to get some details of some places. I wrote a code in Python to automate this using Google places API. I used two queries to automate this function. They are 'nearby search' and 'place details'. I could get some place details after executing the program. But, while executing the program, googlemaps.exceptions.Timeout
exception occured. I'm not enabled billing yet. Is this a problem in my code or some other issue? will this error be solved after enable billing?
gmaps = googlemaps.Client(key = API_Key)
def search_places(location, radius, type):
places = gmaps.places_nearby(location = location, radius = radius, type = type)
time.sleep(3)
pprint.pprint(places)
for place in places['results']:
place_id = place['place_id']
fields = ['name', 'formatted_address', 'formatted_phone_number', 'rating', 'website']
place_details = gmaps.place(place_id = place_id, fields = fields)
pprint.pprint(place_details)
time.sleep(3)
search_places('40.712776,-74.005974', '20000', 'restaurant')
Error is:
raise googlemaps.exceptions.Timeout()
Upvotes: 0
Views: 325
Reputation: 5701
You do need to enable billing for the Places API to work. Check out Google's Billing documentation.
Reminder: To use the Places API, you must include an API key with all API requests and you must enable billing on each of your projects.
Hope this helps.
Upvotes: 1