Skip to content

Commit 81a755a

Browse files
committed
Merge branch 'urllib3_fix_proxy_auth'
2 parents d192b38 + 6016aca commit 81a755a

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

CHANGES.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
**2016-07-12**
2+
3+
*Released 4.3.4*
4+
5+
- Fix proxy support with ``urllib3`` when proxy requires auth
6+
17
**2016-07-08**
28

39
*Released 4.3.3*

telegram/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
from .bot import Bot
8383

8484
__author__ = 'devs@python-telegram-bot.org'
85-
__version__ = '4.3.3'
85+
__version__ = '4.3.4'
8686
__all__ = ['Audio', 'Bot', 'Chat', 'ChatMember', 'ChatAction', 'ChosenInlineResult',
8787
'CallbackQuery', 'Contact', 'Document', 'Emoji', 'File', 'ForceReply',
8888
'InlineKeyboardButton', 'InlineKeyboardMarkup', 'InlineQuery', 'InlineQueryResult',

telegram/utils/request.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,17 @@ def _init_con_pool():
5757
])
5858
proxy_url = _get_con_pool_proxy()
5959
if not proxy_url:
60-
mgr = urllib3.PoolManager
60+
mgr = urllib3.PoolManager(**kwargs)
6161
else:
62-
kwargs['proxy_url'] = proxy_url
6362
if _CON_POOL_PROXY_KWARGS:
6463
kwargs.update(_CON_POOL_PROXY_KWARGS)
65-
mgr = urllib3.ProxyManager
64+
mgr = urllib3.proxy_from_url(proxy_url, **kwargs)
65+
if mgr.proxy.auth:
66+
# TODO: what about other auth types?
67+
auth_hdrs = urllib3.make_headers(proxy_basic_auth=mgr.proxy.auth)
68+
mgr.proxy_headers.update(auth_hdrs)
6669

67-
_CON_POOL = mgr(**kwargs)
70+
_CON_POOL = mgr
6871

6972

7073
def is_con_pool_initialized():

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy