我被所有这些水平的白痴弄糊涂了,我不得不涉水而过--如果我只是刮擦一下就更容易了,不过我想这是一个很好的练习,而且可能在我弄清楚之后会更快。
我的代码如下所示,其中cposts的赋值语句返回404:
import pytumblr
# Authenticate via OAuth
client = pytumblr.TumblrRestClient(
'xxxxxxxxxxxxxxxxxxxxxxxxxxxx'
)
f = client.followers('blog.tumblr.com')
users = f['users']
names = [b['name'] for b in f['users']]
print names
cposts = client.posts(names[0], 'notes_info=True')
print (cposts)但是python信息说: client.posts('codingjester',**params) #获取博客的帖子
所以这篇文章(Getting more than 50 notes with Tumblr API)说你应该用notes_info来获取笔记。但我不知道如何在python中构建它,而不是制作一个url。
我可以使用一个请求来构建一个url,但是我发现使用python/tumblr有一种更简单的方法--我只是还没有搞清楚,如果有人能照亮它的话。
发布于 2015-11-19 16:54:21
删除notes_info=True周围的引号。您应该将值True传递给client的posts()方法的notes_info参数,而实际上是将字符串'notes_info=True'作为位置参数传递,这是无效的,并导致pytumblr创建无效的URL,这就是为什么要获得404。
https://stackoverflow.com/questions/33807909
复制相似问题