-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aiohttp2 support+ssl fix #1
Conversation
a-urth
commented
Apr 5, 2017
- add aiohttp2 compatibility
- change tox respectively
- fix ssl exception handling
- add ssl_context to aiohttp connector
And about aiodns support - since its not used by aiohttp without explicit AsyncResolver usage, only possibility for aiodns errors its if session with corresponding resolver will be passed as parameter. I propose:
|
aioelasticsearch/connection.py
Outdated
} | ||
session_kwargs = {'auth': self.http_auth} | ||
|
||
if AIOHTTP_2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Как я токошо узнал начиная с 1.3 (или мб раньше) оно и так None по дефолту, а дефалтный в 5 минут ставится в request
SSLError) | ||
from yarl import URL | ||
from yarl import URL # noqa # isort:skip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
module level import not on the top because of if statement for aiohttp
|
||
_exc = str(exc) | ||
# aiohttp wraps ssl error | ||
if 'SSL: CERTIFICATE_VERIFY_FAILED' in _exc: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No other way to check it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its just a message, so no.
aioelasticsearch/connection.py
Outdated
from elasticsearch.connection import Connection | ||
from elasticsearch.exceptions import (ConnectionError, ConnectionTimeout, | ||
|
||
from .compat import AIOHTTP_2, create_future # isort:skip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Own party level impoort please
@@ -54,51 +63,118 @@ def __init__( | |||
connector=aiohttp.TCPConnector( | |||
limit=maxsize, | |||
use_dns_cache=kwargs.get('use_dns_cache', False), | |||
ssl_context=ssl_context, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to double check one more time list of parameters from init here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what exactly to double check and what for?