获取错误{{{' code':400,'消息':':'无效的JSON有效负载。出乎意料的令牌。

发布于 2025-01-31 12:56:23 字数 571 浏览 3 评论 0原文

我正在尝试为GoogleAutore运行以下代码,但它给出了错误的JSON有效载荷。

这是代码:

 import requests

 import json

 data = {"comment":"Thank you"}

 headers = 
 {
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) 
   AppleWebKit/537.36 "    "(KHTML, like Gecko) Chrome/94.0.4606.81 
    Safari/537.36 Edg/94.0.992.50",

    "Authorization": "Bearer {token},
 } endpoint="https://mybusiness.googleapis.com/v4/accounts/{accounts_id}/locations/{location_id}/reviews/{reply_id}/reply"

 var=requests.put(endpoint, data=data, headers=headers).json()

 print(var)

I am trying to run the following code for googleautoreply but it is giving the error 'Invalid JSON payload received.

Here is the Code:

 import requests

 import json

 data = {"comment":"Thank you"}

 headers = 
 {
  "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) 
   AppleWebKit/537.36 "    "(KHTML, like Gecko) Chrome/94.0.4606.81 
    Safari/537.36 Edg/94.0.992.50",

    "Authorization": "Bearer {token},
 } endpoint="https://mybusiness.googleapis.com/v4/accounts/{accounts_id}/locations/{location_id}/reviews/{reply_id}/reply"

 var=requests.put(endpoint, data=data, headers=headers).json()

 print(var)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

人事已非 2025-02-07 12:56:23

进行研究后,我知道我们必须以这种方式传递数据

 data = """{"comment":"Thank you"}"""

After doing research I got to know that we have to pass the data in this way

 data = """{"comment":"Thank you"}"""
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文