InfluxDB Python 客户端库使用教程
influxdb-client-python项目地址:https://gitcode.com/gh_mirrors/in/influxdb-client-python
1. 项目的目录结构及介绍
InfluxDB Python 客户端库的目录结构如下:
influxdb-client-python/
├── docs/
│ ├── api_reference.md
│ ├── async_api_reference.md
│ ├── development.md
│ ├── migration_guide.md
│ ├── user_guide.md
│ └── ...
├── examples/
│ ├── batching.py
│ ├── gzip.py
│ ├── pandas.py
│ ├── proxy.py
│ └── ...
├── influxdb_client/
│ ├── __init__.py
│ ├── client/
│ │ ├── __init__.py
│ │ ├── bucket_api.py
│ │ ├── organization_api.py
│ │ └── ...
│ ├── domain/
│ │ ├── __init__.py
│ │ ├── bucket.py
│ │ ├── organization.py
│ │ └── ...
│ ├── extras/
│ │ ├── __init__.py
│ │ ├── pandas_client.py
│ │ └── ...
│ ├── testing/
│ │ ├── __init__.py
│ │ ├── test_client.py
│ │ └── ...
│ └── ...
├── tests/
│ ├── __init__.py
│ ├── test_client.py
│ └── ...
├── .gitignore
├── .travis.yml
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── README.md
├── requirements.txt
├── setup.py
└── ...
目录结构介绍
docs/
:包含项目的文档文件,如API参考、用户指南、开发指南等。examples/
:包含使用该库的示例代码。influxdb_client/
:包含库的核心代码,包括客户端API、数据模型、额外功能等。tests/
:包含测试代码。- 根目录下的文件包括项目配置、许可证、README等。
2. 项目的启动文件介绍
项目的启动文件主要是influxdb_client/__init__.py
,这个文件初始化了客户端库,并导入了主要的模块和类。
# influxdb_client/__init__.py
from .client import InfluxDBClient
from .client.bucket_api import BucketsApi
from .client.organization_api import OrganizationsApi
from .domain.bucket import Bucket
from .domain.organization import Organization
from .extras.pandas_client import PandasClient
from ._version import __version__
__all__ = [
'InfluxDBClient',
'BucketsApi',
'OrganizationsApi',
'Bucket',
'Organization',
'PandasClient',
'__version__'
]
启动文件介绍
InfluxDBClient
:主要的客户端类,用于与InfluxDB进行交互。BucketsApi
和OrganizationsApi
:用于管理存储桶和组织的API。Bucket
和Organization
:数据模型类。PandasClient
:用于与Pandas数据框架交互的额外功能。
3. 项目的配置文件介绍
项目的配置文件主要是setup.py
,这个文件用于安装和管理依赖项。
# setup.py
from setuptools import setup, find_packages
with open('README.md', 'r') as fh:
long_description = fh.read()
setup(
name='influxdb-client',
version='1.46.0dev0',
author='InfluxData',
author_email='contact@influxdata.com',
description='InfluxDB 2.0 python client',
long_description=long_description,
long_description_content_type='text/markdown',
url='https://github.com/influxdata/influxdb-client-python',
packages=find_packages(exclude=['tests']),
install_requires=[
'requests>=2.25.0',
'rx>=3.1.0',
'pandas>=1.1.5',
'aiohttp>=3.7.4',
],
classifiers=[
'Development Status :: 5 - Production/Stable
influxdb-client-python项目地址:https://gitcode.com/gh_mirrors/in/influxdb-client-python
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考