Skip to content

Commit

Permalink
Added certifi (#1066)
Browse files Browse the repository at this point in the history
* Added certifi

* Added changelog
  • Loading branch information
JrooTJunior committed Nov 12, 2022
1 parent 0294bf2 commit 37742a4
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES/1066.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added a mandatory dependency :code:`certifi` in due to in some cases on systems that doesn't have updated ca-certificates the requests to Bot API fails with reason :code:`[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain`
6 changes: 5 additions & 1 deletion aiogram/client/session/aiohttp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations

import asyncio
import ssl
from typing import (
TYPE_CHECKING,
Any,
Expand All @@ -15,6 +16,7 @@
cast,
)

import certifi
from aiohttp import BasicAuth, ClientError, ClientSession, FormData, TCPConnector

from aiogram.methods import Request, TelegramMethod
Expand Down Expand Up @@ -81,7 +83,9 @@ def __init__(self, proxy: Optional[_ProxyType] = None, **kwargs: Any) -> None:

self._session: Optional[ClientSession] = None
self._connector_type: Type[TCPConnector] = TCPConnector
self._connector_init: Dict[str, Any] = {}
self._connector_init: Dict[str, Any] = {
"ssl": ssl.create_default_context(cafile=certifi.where()),
}
self._should_reset_connector = True # flag determines connector state
self._proxy: Optional[_ProxyType] = None

Expand Down
4 changes: 2 additions & 2 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Babel = { version = "^2.9.1", optional = true }
aiohttp-socks = { version = "^0.7.1", optional = true }
# Redis
redis = { version = "^4.3.4", optional = true }
certifi = "^2022.9.24"


[tool.poetry.group.docs.dependencies]
Expand Down
1 change: 1 addition & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ aiosignal==1.2.0 ; python_version >= "3.8" and python_version < "4.0"
async-timeout==4.0.2 ; python_version >= "3.8" and python_version < "4.0"
attrs==22.1.0 ; python_version >= "3.8" and python_version < "4.0"
babel==2.10.3 ; python_version >= "3.8" and python_version < "4.0"
certifi==2022.9.24 ; python_version >= "3.8" and python_version < "4.0"
charset-normalizer==2.1.1 ; python_version >= "3.8" and python_version < "4.0"
frozenlist==1.3.1 ; python_version >= "3.8" and python_version < "4.0"
idna==3.4 ; python_version >= "3.8" and python_version < "4.0"
Expand Down
2 changes: 1 addition & 1 deletion requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ async-timeout==4.0.2 ; python_version >= "3.8" and python_version < "4.0"
attrs==22.1.0 ; python_version >= "3.8" and python_version < "4.0"
babel==2.10.3 ; python_version >= "3.8" and python_version < "4.0"
beautifulsoup4==4.11.1 ; python_version >= "3.8" and python_version < "4.0"
certifi==2022.9.24 ; python_version >= "3.8" and python_version < "4"
certifi==2022.9.24 ; python_version >= "3.8" and python_version < "4.0"
charset-normalizer==2.1.1 ; python_version >= "3.8" and python_version < "4.0"
click-default-group==1.2.2 ; python_version >= "3.8" and python_version < "4.0"
click==8.1.3 ; python_version >= "3.8" and python_version < "4.0"
Expand Down

0 comments on commit 37742a4

Please sign in to comment.