首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在python中通过代理使用Tumblr Api

如何在python中通过代理使用Tumblr Api
EN

Stack Overflow用户
提问于 2018-05-20 07:31:05
回答 1查看 96关注 0票数 0

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

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

任何关于如何实现这一目标的帮助都将受到高度赞赏。谢谢。

这是没有代理的api的正常使用方式。它们是我使用proxy的一种方式。

代码语言:javascript
复制
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.
EN

回答 1

Stack Overflow用户

发布于 2019-02-16 22:56:12

pytumblr使用requests发送超文本传输协议请求。因此,您可以像这样设置bash环境变量'HTTP_PROXY‘和'HTTPS_PROXY’

代码语言:javascript
复制
$ export HTTP_PROXY="http://127.0.0.1:1080" # or socks5
$ export HTTPS_PROXY="http://127.0.0.1:1080"
$ python3 ./tumblr_code.py

代码语言:javascript
复制
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
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50430377

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档