telegraph icon indicating copy to clipboard operation
telegraph copied to clipboard

add socks5h support

Open kuhytitusdlz opened this issue 5 years ago • 4 comments

hello, telegra.ph is blocked in our country, and we use proxy. So, please add support socks5h, like in https://github.com/python-telegram-bot/python-telegram-bot

REQUEST_KWARGS = {'proxy_url': 'socks5h://127.0.0.1:9050',} updater = Updater(token=TOKEN, request_kwargs=REQUEST_KWARGS, use_context=True)

kuhytitusdlz avatar Sep 11 '19 10:09 kuhytitusdlz

It's using requests under the hood, which supports socks5 proxies. I think you can set it via telegraph._telegraph.proxies (also probably you need to pip install requests[socks])

Maybe we can allow to pass TelegraphApi instance to Telegraph via arg. And allow to pass requests session to TelegraphApi. PR is welcome

python273 avatar Sep 29 '19 14:09 python273

it's not working telegraph._telegraph.proxies = dict(https='socks5h://localhost:9050') AttributeError: 'TelegraphApi' object has no attribute 'proxies'

kuhytitusdlz avatar Sep 30 '19 20:09 kuhytitusdlz

oops, it's telegraph._telegraph.session.proxies

python273 avatar Oct 01 '19 05:10 python273

it's works, thanks! goodbye roskomndzor J telegraph._telegraph.session.proxies = {'https':'socks5h://localhost:9050'}

kuhytitusdlz avatar Oct 01 '19 18:10 kuhytitusdlz