Skip to content

Commit fc05d3a

Browse files
committed
switch back to PoolManager
telegram servers might send a reponse with HTTP 302 (redirect) to another hostname. in such case HTTPSConnectionPool will fail to do the job
1 parent bc77c84 commit fc05d3a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

telegram/utils/request.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from telegram.error import Unauthorized, NetworkError, TimedOut, BadRequest
3030

3131
_CON_POOL = None
32-
""":type: urllib3.HTTPSConnectionPool"""
32+
""":type: urllib3.PoolManager"""
3333
CON_POOL_SIZE = 1
3434

3535

@@ -39,8 +39,7 @@ def _get_con_pool():
3939
if _CON_POOL is not None:
4040
return _CON_POOL
4141

42-
_CON_POOL = urllib3.HTTPSConnectionPool(
43-
host='api.telegram.org',
42+
_CON_POOL = urllib3.PoolManager(
4443
maxsize=CON_POOL_SIZE,
4544
cert_reqs='CERT_REQUIRED',
4645
ca_certs=certifi.where(),
@@ -57,7 +56,7 @@ def is_con_pool_initialized():
5756
def stop_con_pool():
5857
global _CON_POOL
5958
if _CON_POOL is not None:
60-
_CON_POOL.close()
59+
_CON_POOL.clear()
6160
_CON_POOL = None
6261

6362

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