如何通过python中的代理使用Tumblr API



如何通过代理使用 Tumblr api。 任何帮助将不胜感激。

我想使用通过代理进行 api 调用的 Tumblr api。

任何关于如何实现这一目标的帮助将不胜感激。 谢谢。

这是在没有代理的情况下使用 api 的正常方式。它们是我将其与代理一起使用的一种方式吗?

import pytumblr
client = pytumblr.TumblrRestClient(
'<consumer_key>',
'<consumer_secret>',
'<oauth_token>',
'<oauth_secret>',
)
client.info() # get information about the authenticating user
client.dashboard() # get the dashboard for the authenticating user
client.likes() # get the likes for the authenticating user
client.following() # get the blogs followed by the authenticating user
# How can I use it with proxy, that's authenticate with proxy.

pytumblr 使用请求来发送 HTTP 请求。 因此,您可以像 bash 环境变量"HTTP_PROXY"和"HTTPS_PROXY"一样设置 bash 环境变量

$ export HTTP_PROXY="http://127.0.0.1:1080" # or socks5
$ export HTTPS_PROXY="http://127.0.0.1:1080"
$ python3 ./tumblr_code.py

import os
os.environ['HTTP_PROXY'] = 'http://127.0.0.1:1080'
os.environ['HTTPS_PROXY'] = 'http://127.0.0.1:1080'
// remaining pytumblr codes

最新更新