OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Fetch Response To Google Map Reviews

  • Thread starter Thread starter fast_crawler
  • Start date Start date
F

fast_crawler

Guest
I'm using below code to fetch google map reviews, however, the API is not able to fetch Owner's Response to reviews. How can I capture the responses to reviews left in google places?

Code:
place_id = 'ChIJLc8UZFdqXz4ROODwebhx2rM'
api_key = 'abc-xyz'
url = f'https://maps.googleapis.com/maps/api/place/details/json?placeid={place_id}&key={api_key}'

response = requests.get(url)
data = response.json()

# Extract reviews and owner responses
if 'result' in data and 'reviews' in data['result']:
    reviews = data['result']['reviews']
    review_countr=0
    for review in reviews:
        author_name = review.get('author_name')
        rating = review.get('rating')
        text = review.get('text')
        owner_response = review.get('owner_response', 'No response from owner')
        print(f"\nCounter: {review_countr}")
        print(f"Review by {author_name} ({rating} stars): {text}")
        print(f"Owner's response: {owner_response}")
        review_countr+=1
else:
    print("No reviews found for this place.")
<p>I'm using below code to fetch google map reviews, however, the API is not able to fetch Owner's Response to reviews. How can I capture the responses to reviews left in google places?</p>
<pre class="lang-py prettyprint-override"><code>place_id = 'ChIJLc8UZFdqXz4ROODwebhx2rM'
api_key = 'abc-xyz'
url = f'https://maps.googleapis.com/maps/api/place/details/json?placeid={place_id}&key={api_key}'

response = requests.get(url)
data = response.json()

# Extract reviews and owner responses
if 'result' in data and 'reviews' in data['result']:
reviews = data['result']['reviews']
review_countr=0
for review in reviews:
author_name = review.get('author_name')
rating = review.get('rating')
text = review.get('text')
owner_response = review.get('owner_response', 'No response from owner')
print(f"\nCounter: {review_countr}")
print(f"Review by {author_name} ({rating} stars): {text}")
print(f"Owner's response: {owner_response}")
review_countr+=1
else:
print("No reviews found for this place.")

</code></pre>
 

Latest posts

A
Replies
0
Views
1
Alvah_Franey
A
H
Replies
0
Views
1
habrewning
H
Top