Как я могу использовать API Tumblr через прокси. Любая помощь будет оценена по достоинству.
Я хочу использовать 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, например
$ 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