Google我的业务API Python-构建错误 - 未知
我正在尝试更新Google在Blask应用程序中的封面照片。以下是我实现同样的代码。
SCOPES = ["https://www.googleapis.com/auth/business.manage"]
API_SERVICE_NAME = "mybusiness"
API_VERSION = "v1"
API_KEY = "api-key-here"
CLIENT_SECRETS_FILE = "client_secret.json"
SCOPES = ["https://www.googleapis.com/auth/business.manage"]
gmb_app_verify_business_test.credentials = google.oauth2.credentials.Credentials(
**flask.session["credentials"])
flask.session["credentials"] = modules.credentials_to_dict(
gmb_app_verify_business_test.credentials)
service = googleapiclient.discovery.build(
API_SERVICE_NAME,
API_VERSION,
credentials=credentials,
developerKey=API_KEY,
discoveryServiceUrl="https://mybusiness.googleapis.com/$discovery/rest?version=v1",
)
cover_update_status = (
service.accounts()
.locations()
.media()
.create(
parent='accounts/xxxxxxxxxxxx/locations/xxxxxxxxxxxxxxxxxxxxxx',
body={
"name": "IFB Point Cover",
"mediaFormat": "PHOTO",
"locationAssociation": {
"category": "COVER",
},
"sourceUrl": "https://www.ifbappliances.com/media/ifb/ifb-point-cover.png",
},
)
.execute()
)
这给出了一个错误: googleapiclient.errors.unknownapinameorversion:name:myBusiness版本:v1
我尝试将版本更改为 api_version
to v4
和<代码> DiscoveryServiceurl V4
。但是错误仍然存在。
到目前为止已转介的文档:
,但似乎没有什么可用。请提出建议。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你快到了。
对于
api_version
,您需要将其设置为v4
;因为MyBusiness
服务在V4上工作。对于Discoveryurl,您需要以下以下将其传递:
You are almost there.
For
API_VERSION
, you need to set it tov4
; because themybusiness
service is working on v4.And for discoveryUrl, you need to pass it as following: