DM-aioinfluxdb
Urls
Usage
Write
from dm_aioinfluxdb import DMAioInfluxDBClient
import asyncio
async def main():
# create client
influxdb_client = DMAioInfluxDBClient("localhost", 8086, "org", "token")
# create influxdb points
point1 = influxdb_client.create_point("example-measurement", {"value": 1.5}, {"tag1": "tag1-value"})
# or
point2 = DMAioInfluxDBClient.create_point("example-measurement", {"value": 0}, {"tag2": "tag2-value"})
# write one or more points
await influxdb_client.write("example-bucket", point1)
# write line protocol record
record = "example-measurement,tag1=tag1-value, value=1.5 1713162515"
await influxdb_client.write("example-bucket", record)
# type: bool
status = await influxdb_client.write("example-bucket", [point1, point2])
# return error message in case of error
# type: (bool, str)
status, err_msg = await influxdb_client.write("example-bucket", point1, return_errors=True)
# without error logs in case of errors
await influxdb_client.write("example-bucket", point1, err_logging=False)
if __name__ == "__main__":
asyncio.run(main())
Query
from dm_aioinfluxdb import DMAioInfluxDBClient
import asyncio
async def main():
# create client
influxdb_client = DMAioInfluxDBClient("localhost", 8086, "org", "token")
# write query
query = 'from(bucket: "example") |> range(start: -1h) |> filter(fn: (r) => r._measurement == "monitoring" and r._field == "cpu")'
# type: <class 'influxdb_client.client.flux_table.TableList'>
table_res = await influxdb_client.query(query)
# type: str
json_res = await influxdb_client.query(query, to="json")
# type: list[dict]
list_res = await influxdb_client.query(query, to="list")
# return error message in case of error
# type: (str, str)
json_res, err_msg = await influxdb_client.query(query, to="json", return_errors=True)
# without error logs in case of errors
res = await influxdb_client.query(query, err_logging=False)
if __name__ == "__main__":
asyncio.run(main())
Set custom logger
If you want set up custom logger
from dm_aioinfluxdb import DMAioInfluxDBClient
# create custom logger
class MyLogger:
def debug(self, message):
pass
def info(self, message):
pass
def warning(self, message):
print(message)
def error(self, message):
print(message)
# set up custom logger for all clients
DMAioInfluxDBClient.set_logger(MyLogger())
Metadata
Release files for dm-aioinfluxdb 0.2.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dm_aioinfluxdb-0.2.7.tar.gz | 3.7 kB | Without provenance | Details for dm_aioinfluxdb-0.2.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dm_aioinfluxdb-0.2.7-py3-none-any.whl | Python 3 | none | any | Details for dm_aioinfluxdb-0.2.7-py3-none-any.whl |
Total release size: 7.8 kB
Release files / dm_aioinfluxdb-0.2.7.tar.gz
| Download URL | dm_aioinfluxdb-0.2.7.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7642ae8617e5b44fa35bc0f5550286a9d9d7e6963eb6b7b640369601517f22b
|
|
BLAKE2b-256 checksum How to use checksums |
335c123cbc4461c1df50fa6882ea99daf666617e3d6842eb29f36db2e95f70f8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / dm_aioinfluxdb-0.2.7-py3-none-any.whl
| Download URL | dm_aioinfluxdb-0.2.7-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2f1636b9216ce731f53d6dc43df0409c7aeab0e3656a83b03e4912f5a1ceaee
|
|
BLAKE2b-256 checksum How to use checksums |
5a99b1823ad05d9cb582a359d8054d9132816b8dfb349f006fdc2ab5bb29f5b4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for dm-aioinfluxdb 0.2.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.