我的代码如下,其中cposts的赋值语句返回404:
import pytumblr# Authenticate via OAuthclIEnt = pytumblr.TumblrRestClIEnt( 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx')f = clIEnt.followers('blog.tumblr.com')users = f['users']names = [b['name'] for b in f['users']]print namescposts = clIEnt.posts(names[0],'notes_info=True')print (cposts)
但是python API信息说:clIEnt.posts(‘Codingjester’,** params)#获取博客的帖子
这个SO帖子(Getting more than 50 notes with Tumblr API)说你应该使用notes_info来获取笔记.但我不知道如何在python中构建它而不是制作一个url.
我可以使用构建URL的请求,但我认为有一种更简单的方法使用python / tumblr API我只是没有想出来,如果有人能照亮请.
解决方法 删除notes_info = True周围的引号.您应该将值True传递给客户端的posts()方法的notes_info参数.相反,您实际上是将字符串’notes_info = True’作为位置参数传递,这是无效的并导致pytumblr创建无效的URL,这就是您获得404的原因. 总结以上是内存溢出为你收集整理的如何使用python / tumblr api从帖子中获取备注信息?全部内容,希望文章能够帮你解决如何使用python / tumblr api从帖子中获取备注信息?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)