Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Commit 60ff0c2

Browse files
author
徐鹏
committed
update readme
1 parent cab86ba commit 60ff0c2

File tree

1 file changed

+29
-43
lines changed

1 file changed

+29
-43
lines changed

README.md

Lines changed: 29 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,6 @@
11
## InfluxDB-Python-Aio
22
--------------
33

4-
.. image:: https://travis-ci.org/influxdata/influxdb-python.svg?branch=master
5-
:target: https://travis-ci.org/influxdata/influxdb-python
6-
.. image:: https://readthedocs.org/projects/influxdb-python/badge/?version=latest&style
7-
:target: http://influxdb-python.readthedocs.org/
8-
:alt: Documentation Status
9-
10-
.. image:: https://img.shields.io/coveralls/influxdata/influxdb-python.svg
11-
:target: https://coveralls.io/r/influxdata/influxdb-python
12-
:alt: Coverage
13-
14-
.. image:: https://img.shields.io/pypi/v/influxdb.svg
15-
:target: https://pypi.org/project/influxdb-aio/
16-
:alt: PyPI Status
17-
18-
--------------
19-
204
### Statement
215
**This was forked from (https://github.com/influxdata/influxdb-python), and support asyncio.**<br/>
226
[Here](README.original.rst) is the original README document. You can find more detail about InfluxDB-Python (client) and also influxdb (database). Here is only some difference and basic usage.
@@ -54,36 +38,38 @@ Main dependency is:
5438

5539
Here's a basic example (for more see the examples directory)
5640

57-
~~~python
58-
import asyncio
59-
from influxdb_aio import InfluxDBClient
60-
61-
json_body = [
62-
{
63-
"measurement": "cpu_load_short",
64-
"tags": {
65-
"host": "server01",
66-
"region": "us-west"
67-
},
68-
"time": "2009-11-10T23:00:00Z",
69-
"fields": {
70-
"value": 0.64
71-
}
41+
```python
42+
import asyncio
43+
from influxdb_aio import InfluxDBClient
44+
45+
46+
json_body = [
47+
{
48+
"measurement": "cpu_load_short",
49+
"tags": {
50+
"host": "server01",
51+
"region": "us-west"
52+
},
53+
"time": "2009-11-10T23:00:00Z",
54+
"fields": {
55+
"value": 0.64
7256
}
73-
]
57+
}
58+
]
59+
7460

75-
async def init_client():
76-
client = await InfluxDBClient('localhost', 8086, 'root', 'root', 'example')
77-
await client.create_database('example')
78-
return client.write_points(json_body)
61+
async def init_client():
62+
client = await InfluxDBClient('localhost', 8086, 'root', 'root', 'example')
63+
await client.create_database('example')
64+
return client.write_points(json_body)
7965

8066

81-
async def main():
82-
client = await init_client()
83-
result = await client.query('select value from cpu_load_short;')
84-
print("Result: {0}".format(result))
67+
async def main():
68+
client = await init_client()
69+
result = await client.query('select value from cpu_load_short;')
70+
print("Result: {0}".format(result))
8571

8672

87-
if __name__ == '__main__' :
88-
asyncio.get_event_loop().run_until_complete(main())
89-
~~~
73+
if __name__ == '__main__' :
74+
asyncio.get_event_loop().run_until_complete(main())
75+
```

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy