1
0
mirror of https://github.com/eternnoir/pyTelegramBotAPI.git synced 2023-08-10 21:12:57 +03:00

Remove ssl

This commit is contained in:
coder2020official 2022-05-22 01:02:55 +05:00
parent 0c59d1187e
commit 8da749ee05
2 changed files with 3 additions and 6 deletions

View File

@ -1,5 +1,4 @@
pytest pytest
requests==2.20.0 requests==2.20.0
wheel==0.24.0 wheel==0.24.0
aiohttp>=3.8.0,<3.9.0 aiohttp>=3.8.0,<3.9.0
certifi

View File

@ -1,7 +1,6 @@
import asyncio # for future uses import asyncio # for future uses
import aiohttp import aiohttp
from telebot import types from telebot import types
import ssl, certifi
try: try:
import ujson as json import ujson as json
@ -27,15 +26,14 @@ REQUEST_LIMIT = 50
class SessionManager: class SessionManager:
def __init__(self) -> None: def __init__(self) -> None:
self.ssl_context = ssl.create_default_context(cafile=certifi.where())
self.session = aiohttp.ClientSession(connector=aiohttp.TCPConnector( self.session = aiohttp.ClientSession(connector=aiohttp.TCPConnector(
limit=REQUEST_LIMIT, ssl=self.ssl_context limit=REQUEST_LIMIT
)) ))
async def create_session(self): async def create_session(self):
self.session = aiohttp.ClientSession(connector=aiohttp.TCPConnector( self.session = aiohttp.ClientSession(connector=aiohttp.TCPConnector(
limit=REQUEST_LIMIT, ssl=self.ssl_context limit=REQUEST_LIMIT
)) ))
return self.session return self.session