mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-16 12:25:45 +01:00
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
This commit is contained in:
parent
bc77c845ea
commit
fc05d3a626
1 changed files with 3 additions and 4 deletions
|
@ -29,7 +29,7 @@ from telegram import (InputFile, TelegramError)
|
|||
from telegram.error import Unauthorized, NetworkError, TimedOut, BadRequest
|
||||
|
||||
_CON_POOL = None
|
||||
""":type: urllib3.HTTPSConnectionPool"""
|
||||
""":type: urllib3.PoolManager"""
|
||||
CON_POOL_SIZE = 1
|
||||
|
||||
|
||||
|
@ -39,8 +39,7 @@ def _get_con_pool():
|
|||
if _CON_POOL is not None:
|
||||
return _CON_POOL
|
||||
|
||||
_CON_POOL = urllib3.HTTPSConnectionPool(
|
||||
host='api.telegram.org',
|
||||
_CON_POOL = urllib3.PoolManager(
|
||||
maxsize=CON_POOL_SIZE,
|
||||
cert_reqs='CERT_REQUIRED',
|
||||
ca_certs=certifi.where(),
|
||||
|
@ -57,7 +56,7 @@ def is_con_pool_initialized():
|
|||
def stop_con_pool():
|
||||
global _CON_POOL
|
||||
if _CON_POOL is not None:
|
||||
_CON_POOL.close()
|
||||
_CON_POOL.clear()
|
||||
_CON_POOL = None
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue