From 7c908db901602100eadf8005f378af42f25008f3 Mon Sep 17 00:00:00 2001 From: Noam Meltzer Date: Tue, 12 Jul 2016 23:31:38 +0300 Subject: [PATCH 1/2] urllib3: can now connect through proxies which require auth fixes #343 --- telegram/utils/request.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/telegram/utils/request.py b/telegram/utils/request.py index 99539bfb8..1ace3fc4f 100644 --- a/telegram/utils/request.py +++ b/telegram/utils/request.py @@ -57,14 +57,17 @@ def _init_con_pool(): ]) proxy_url = _get_con_pool_proxy() if not proxy_url: - mgr = urllib3.PoolManager + mgr = urllib3.PoolManager(**kwargs) else: - kwargs['proxy_url'] = proxy_url if _CON_POOL_PROXY_KWARGS: kwargs.update(_CON_POOL_PROXY_KWARGS) - mgr = urllib3.ProxyManager + mgr = urllib3.proxy_from_url(proxy_url, **kwargs) + if mgr.proxy.auth: + # TODO: what about other auth types? + auth_hdrs = urllib3.make_headers(proxy_basic_auth=mgr.proxy.auth) + mgr.proxy_headers.update(auth_hdrs) - _CON_POOL = mgr(**kwargs) + _CON_POOL = mgr def is_con_pool_initialized(): From 6016aca0bab4ecfd544210e315fbd2ca48c7ebf3 Mon Sep 17 00:00:00 2001 From: Noam Meltzer Date: Tue, 12 Jul 2016 23:34:49 +0300 Subject: [PATCH 2/2] Bump version to v4.3.4 --- CHANGES.rst | 6 ++++++ telegram/__init__.py | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index d525babd1..60b46c0a3 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +**2016-07-12** + +*Released 4.3.4* + +- Fix proxy support with ``urllib3`` when proxy requires auth + **2016-07-08** *Released 4.3.3* diff --git a/telegram/__init__.py b/telegram/__init__.py index 4b1b74f11..4c7d13aca 100644 --- a/telegram/__init__.py +++ b/telegram/__init__.py @@ -82,7 +82,7 @@ from .update import Update from .bot import Bot __author__ = 'devs@python-telegram-bot.org' -__version__ = '4.3.3' +__version__ = '4.3.4' __all__ = ['Audio', 'Bot', 'Chat', 'ChatMember', 'ChatAction', 'ChosenInlineResult', 'CallbackQuery', 'Contact', 'Document', 'Emoji', 'File', 'ForceReply', 'InlineKeyboardButton', 'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult',