如何从 python/tumblr api 的帖子中获取注释信息?
How do I get notes info from posts with python/tumblr api?
我对所有这些级别的听写感到很困惑,我不得不费力地通过它会更容易 imo 只是通过 scraping 来完成它,但是我想这是学习听写的一个很好的练习并且会等我弄明白了也许会更快。
我的代码如下,其中赋值语句为cposts
returns a 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 api 信息说:client.posts('codingjester', **params) # get posts for a blog
而这个 SO post (Getting more than 50 notes with Tumblr API) 说你应该使用 notes_info 来获取注释。但我不知道如何在 python 中构建它而不是制作 url.
我可以使用构建 url 的请求,但我认为使用 python/tumblr api 有一种更简单的方法 我只是还没弄清楚,如果有人可以阐明请
删除 notes_info=True
周围的引号。您应该将值 True
传递给 client
的 posts()
方法的 notes_info
参数。相反,您实际上是将字符串 'notes_info=True'
作为位置参数传递,这是无效的并导致 pytumblr 创建无效的 URL,这就是您得到 404.
的原因
我对所有这些级别的听写感到很困惑,我不得不费力地通过它会更容易 imo 只是通过 scraping 来完成它,但是我想这是学习听写的一个很好的练习并且会等我弄明白了也许会更快。
我的代码如下,其中赋值语句为cposts
returns a 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 api 信息说:client.posts('codingjester', **params) # get posts for a blog
而这个 SO post (Getting more than 50 notes with Tumblr API) 说你应该使用 notes_info 来获取注释。但我不知道如何在 python 中构建它而不是制作 url.
我可以使用构建 url 的请求,但我认为使用 python/tumblr api 有一种更简单的方法 我只是还没弄清楚,如果有人可以阐明请
删除 notes_info=True
周围的引号。您应该将值 True
传递给 client
的 posts()
方法的 notes_info
参数。相反,您实际上是将字符串 'notes_info=True'
作为位置参数传递,这是无效的并导致 pytumblr 创建无效的 URL,这就是您得到 404.