I’m currently attempting to use the Google Business API to fetch reviews within a Python application. My approach was to follow the guidelines provided in the official Google documentation regarding the use of MyBusinessAccount
. I have set up the code as follows:
MyBusinessAccount, flags = sample_tools.init(
argv,
"mybusiness",
"v4",
__doc__,
__file__,
scope="https://www.googleapis.com/auth/business.manage",
)
Despite adhering to the instructions, I encountered an error when attempting to initialize access to the MyBusiness
service. The error output is:
googleapiclient.errors.UnknownApiNameOrVersion: name: mybusiness version: v4
This suggests that the API name ‘mybusiness’ or the version ‘v4’ is not recognized, which is perplexing as I was under the impression that these were correct and current. I’m looking for assistance to understand the root of this issue and how to correctly establish a connection to the Google Business API so that I can retrieve reviews effectively.
Here are the details of the environment and versions I am using, which may aid in troubleshooting the problem:
Python Version: 3.12.0
Google API Python Client Version: 2.110.0
Operating System: Linux
I initiated my attempt by setting up the Google API Python client and writing the necessary code to call the Google Business API, as per the official documentation. I was expecting the sample_tools.init method to authenticate successfully and create a MyBusinessAccount
instance that could be used to fetch reviews from the API. However, instead of successful authentication and retrieval of reviews, I was presented with the UnknownApiNameOrVersion
error. This was unexpected, as I had followed all setup instructions and used the correct API name and version, leading me to seek assistance in identifying the cause of the error and finding a solution.