Google协作平台API PUT请求提供状态代码400(错误请求)

时间:2018-01-03 18:15:15

标签: python google-api python-requests google-sites

我在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

我已经广泛搜索了他们的指南和参考资料here。 提前谢谢。

编辑1

我创建的网站是经典网站。

0 个答案:

没有答案