我运行了一段时间的python脚本在我的blogspot博客上发布文章。 一切都很顺利,直到我开始得到这个身份验证错误
RequestError: {'status': 401, 'body': 'User does not have permission to create new post', 'reason': 'Unauthorized'}
我真的不明白如何通过阅读gdata文档来修复它。你知道吗
你能告诉我怎么做吗?你知道吗
谢谢
下面是我代码中不再有效的部分:
from gdata import service
import gdata
import atom
blogger_service = service.GDataService('xxxxxx','xxxxxx')
blogger_service.service = 'blogger'
blogger_service.account_type = 'GOOGLE'
blogger_service.server = 'www.blogger.com'
blogger_service.ProgrammaticLogin()
def CreatePublicPost(blogger_service, blog_id, title, content,tags):
entry = gdata.GDataEntry()
entry.title = atom.Title('xhtml', title)
entry.content = atom.Content(content_type='html', text=content)
for tag in tags :
category = atom.Category(term=tag, scheme="http://www.blogger.com/atom/ns#")
entry.category.append(category)
return blogger_service.Post(entry, '/feeds/%s/posts/default' % blog_id)
现在有一个API版本3.0。。。你知道吗
这个旧版本已经过时了,显然已经不能用了。。。你知道吗
您可以在这里找到更多信息: https://developers.google.com/blogger/https://developers.google.com/blogger/docs/3.0/using/
如果您对身份验证有疑问,这些链接可能会有所帮助:
Having trouble trying to use gdata and oauth2 in python
Authentication with the Google Docs List API, Python and OAuth 2
相关问题 更多 >
编程相关推荐