Skip to content

Can't use socks5h proxy #1516

@404neko

Description

@404neko

Steps to reproduce

set up a socks5 proxy at 127.0.0.1:1080

from telegram.ext import Updater
REQUEST_KWARGS = {}
REQUEST_KWARGS['proxy_url'] = 'socks5h://127.0.0.1:1080'
updater = Updater('TOKEN', request_kwargs=REQUEST_KWARGS)

Expected behaviour

the bot will run normaly.

Actual behaviour

Throw an exception
Traceback (most recent call last):
File "Core.py", line 125, in
updater = Updater(TOKEN, request_kwargs=REQUEST_KWARGS)
File "D:\Bin\Python\Python37\lib\site-packages\telegram\ext\updater.py", line 135, in init
self._request = Request(**request_kwargs)
File "D:\Bin\Python\Python37\lib\site-packages\telegram\utils\request.py", line 143, in init
mgr = SOCKSProxyManager(proxy_url, **kwargs)
File "D:\Bin\Python\Python37\lib\site-packages\telegram\vendor\ptb_urllib3\urllib3\contrib\socks.py", line 160, in init
"Unable to determine SOCKS version from %s" % proxy_url
ValueError: Unable to determine SOCKS version from socks5h://127.0.0.1:1080

Configuration

Operating System:
Win10
python-telegram-bot 12.1.0
requests 2.22.0
setuptools 40.8.0
shiboken2 5.13.1
six 1.12.0
tornado 6.0.3
urllib3 1.25.3

Version of Python, python-telegram-bot & dependencies:

$ python -m telegram

Logs

Insert logs here (if necessary)
python-telegram-bot 12.1.0
certifi 2019.09.11
future 0.17.1
Python 3.7.4 (tags/v3.7.4:e09359112e, Jul 8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]

I think python-telegram-bot is using an old urllib3 include in the package localed at
site-packages\telegram\vendor\ptb_urllib3\urllib3
the urllib3 can't handle socks5h

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions