Sandra
Sandra

Reputation: 21

Fetch reviews using GMB API with Python

I'm trying to fetch reviews with the Google My Business API using Python, but since I'm new at this, I'm facing some problems I don't understand very well.

I created a service in order to use the my business api, and used the reviews method :

    path  = os.path.abspath('')+'\\'
    service, flags = sample_tools.init(['Google Reviews.ipynb'], "mybusiness", "v4", __doc__, path, 
                                       scope="https://www.googleapis.com/auth/business.manage", 
                                       discovery_filename=discovery_doc)

    reviewsApi = service.accounts().locations().reviews()
    request = reviewsApi.list(parent=location)

However, I keep getting this error :

reviewsApi = service.accounts().locations().reviews()
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Resource' object has no attribute 'locations'

I think it is coming from the discovery doc I downloaded, which might be wrong (I don't remember where I got it from). I tried downloading it from this website :

using this link : text

But I don't think it is valid anymore :

Does anybody know how can I fix this problem please? Where can I find the correct discovery doc file? Or maybe I am not using the right API?

Upvotes: 2

Views: 749

Answers (1)

Related Questions