Ad
Discrepancy Between Python Googlemaps Library And Google Places API Call With Postman
When I retrieve JSON code from Google Places API with Postman with this GET call:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?types=movie_theater&location=-36.8485,174.763336&radius=10000&key=PutYourAPIKeyHere
I see that after "types"
there is "vicinity"
; then the brackets close and open again for the next business:
But if I use the official Google Maps Python library in order to retrieve the same call:
import googlemaps
gmaps = googlemaps.Client(key='PutYourAPIKeyHere')
search_loction = gmaps.places("nearby",location='-36.8485, 174.763336', type="movie_theater")
print (search_loction)
I see that after "types"
there is no "vicinity"
and brackets are closing like it was the last element for that business?
In the Postman API call I'm passing nearbysearch
while with Python I'm passing nearby
.
So is nearbysearch
the same as nearby
?
If not what is the nearbysearch for googlemaps library?
Ad
Answer
I found the solution by myself, I will post the answer for those who struggles like me:
import googlemaps
gmaps = googlemaps.Client(key='PutYourAPIKeyHere')
search_loction = gmaps.places_nearby(location='-36.8485, 174.763336', type="movie_theater",radius="10000")
#print (search_loction)
Total_Places_Found = 0
if search_loction['status'] == 'OK':
Total_Places_Found += len(search_loction['results'])
for element in search_loction['results']:
Place_ID = element['place_id']
ID = element['id']
Name = element['name']
Latitude = element['geometry']['location']['lat']
Longitude = element['geometry']['location']['lng']
Rating = element['rating']
Types = element['types']
vicinity = element['vicinity']
print (vicinity)
Ad
source: stackoverflow.com
Related Questions
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Django, code inside <script> tag doesn't work in a template
- → React - Django webpack config with dynamic 'output'
- → GAE Python app - Does URL matter for SEO?
- → Put a Rendered Django Template in Json along with some other items
- → session disappears when request is sent from fetch
- → Python Shopify API output formatted datetime string in django template
- → Can't turn off Javascript using Selenium
- → WebDriver click() vs JavaScript click()
- → Shopify app: adding a new shipping address via webhook
- → Shopify + Python library: how to create new shipping address
- → shopify python api: how do add new assets to published theme?
- → Access 'HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT' with Python Shopify Module
Ad