This repository was archived by the owner on Mar 20, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Expand file tree Collapse file tree 1 file changed +28
-3
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,27 @@ response.
7
7
8
8
Sniffing (when requested) is also done via a scheduled coroutine.
9
9
10
- Example::
10
+ Example for python 3.5+
11
+
12
+ .. code-block:: python
13
+
14
+ import asyncio
15
+ from elasticsearch_async import AsyncElasticsearch
16
+
17
+ client = AsyncElasticsearch(hosts=['localhost', 'other-host'])
18
+
19
+ async def print_info():
20
+ info = await client.info()
21
+ print(info)
22
+
23
+ loop = asyncio.get_event_loop()
24
+ loop.run_until_complete(print_info())
25
+ loop.run_until_complete(client.transport.close())
26
+ loop.close()
27
+
28
+ Example for python 3.4
29
+
30
+ .. code-block:: python
11
31
12
32
import asyncio
13
33
from elasticsearch_async import AsyncElasticsearch
@@ -25,7 +45,9 @@ Example::
25
45
loop.close()
26
46
27
47
28
- Example with SSL Context::
48
+ Example with SSL Context
49
+
50
+ .. code-block:: python
29
51
30
52
import asyncio
31
53
from elasticsearch_async import AsyncElasticsearch
@@ -61,10 +83,13 @@ used to pass in an event loop you wish the client to use. By default
61
83
Installation
62
84
------------
63
85
64
- ``elasticsearch-async`` is available via PyPI so you can install it using pip::
86
+ ``elasticsearch-async`` is available via PyPI so you can install it using pip
87
+
88
+ .. code-block:: bash
65
89
66
90
pip install elasticsearch-async
67
91
92
+
68
93
License
69
94
-------
70
95
You can’t perform that action at this time.
0 commit comments