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', 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():