Skip to content

Add AIOHttpConnection and [async] extra #1232

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 5 commits into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,8 @@ pandas
pyyaml<5.3

black; python_version>="3.6"

# Requirements for testing [async] extra
aiohttp; python_version>="3.6"
pytest-asyncio; python_version>="3.6"
unasync; python_version>="3.6"
14 changes: 14 additions & 0 deletions elasticsearch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
__version__ = VERSION
__versionstr__ = ".".join(map(str, VERSION))

import sys
import logging
import warnings

Expand Down Expand Up @@ -64,3 +65,16 @@
"AuthorizationException",
"ElasticsearchDeprecationWarning",
]

try:
# Asyncio only supported on Python 3.6+
if sys.version_info < (3, 6):
raise ImportError

from ._async.http_aiohttp import AIOHttpConnection
from ._async.transport import AsyncTransport
from ._async.client import AsyncElasticsearch

__all__ += ["AIOHttpConnection", "AsyncTransport", "AsyncElasticsearch"]
except (ImportError, SyntaxError):
pass
3 changes: 3 additions & 0 deletions elasticsearch/_async/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Licensed to Elasticsearch B.V under one or more agreements.
# Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
# See the LICENSE file in the project root for more information
Loading