谷歌网站API放置请求,给出状态码400(错误请求)

2024-03-29 12:57:37 发布

您现在位置:Python中文网/ 问答频道 /正文

我在上面创建了一个页面网址:sites.google.com名称为nastyusb12345。你知道吗

发送PUT请求将导致状态代码400(错误请求)

Python 3.5.3 (default, Nov 23 2017, 11:34:05) 
[GCC 6.3.0 20170406] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> g = requests.get("https://sites.google.com/feeds/content/site/nastyusb12345/")
>>> g.status_code
200
>>> # to convert the byte stream returned by g.content to str i use .decode("utf-8") on the former one
... 
>>> # using the link for the put request given in the LINK tag with rel attribute as 'edit'
... 
>>> p = requests.put("https://sites.google.com/feeds/content/site/nastyusb12345/8957364112836929772", g.content.decode("utf-8"))
>>> p.status_code
400

我已经广泛地搜索了他们的指南和参考资料。 提前谢谢。你知道吗

编辑1

我创建的站点是一个经典站点。你知道吗


Tags: thetohttpscomforonstatusgoogle