Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/influxdb/__pycache__/client.cpython-39.pyc
Ðазад
a p�h� � @ s0 d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlZddlZddl Z ddl Z ddlZddlZddl Z ddlZddlmZmZ ddlZddlZddlZddlmZ dd lmZ dd lmZmZmZ ddlmZ dd lmZ ddlm Z G dd� de!�Z"dd� Z#dd� Z$dd� Z%G dd� de�Z&dS )zPython client for InfluxDB.� )�absolute_import)�division)�print_function)�unicode_literalsN)�chain�islice)�HTTPAdapter)�urlparse)� make_lines�quote_ident� quote_literal�� ResultSet� )�InfluxDBClientError)�InfluxDBServerErrorc @ s� e Zd ZdZdldd�Zd d� Zdd� Zedd� �Zedd� �Z edd� �Z edd� �Zedd� �Zedd� �Z edd� �Zdd � Zd!d"� Zdmd%d&�Zdnd)d*�Zedod,d-��Zdpd/d0�Zdqd1d2�Zd3d4� Zed5d6� �Zdrd7d8�Zd9d:� Zdsd;d<�Zd=d>� Zd?d@� ZdAdB� ZdCdD� Z dtdFdG�Z!dudHdI�Z"dvdJdK�Z#dwdLdM�Z$dNdO� Z%dxdPdQ�Z&dRdS� Z'dTdU� Z(dydVdW�Z)dXdY� Z*dZd[� Z+d\d]� Z,d^d_� Z-d`da� Z.dbdc� Z/dzddde�Z0d{dfdg�Z1d|dhdi�Z2djdk� Z3dS )}�InfluxDBClientuj InfluxDBClient primary client object to connect InfluxDB. The :class:`~.InfluxDBClient` object holds information necessary to connect to InfluxDB. Requests can be made to InfluxDB directly through the client. The client supports the use as a `context manager <https://docs.python.org/3/reference/datamodel.html#context-managers>`_. :param host: hostname to connect to InfluxDB, defaults to 'localhost' :type host: str :param port: port to connect to InfluxDB, defaults to 8086 :type port: int :param username: user to connect, defaults to 'root' :type username: str :param password: password of the user, defaults to 'root' :type password: str :param pool_size: urllib3 connection pool size, defaults to 10. :type pool_size: int :param database: database name to connect to, defaults to None :type database: str :param ssl: use https instead of http to connect to InfluxDB, defaults to False :type ssl: bool :param verify_ssl: verify SSL certificates for HTTPS requests, defaults to False :type verify_ssl: bool :param timeout: number of seconds Requests will wait for your client to establish a connection, defaults to None :type timeout: int :param retries: number of attempts your client will make before aborting, defaults to 3 0 - try until success 1 - attempt only once (without retry) 2 - maximum two attempts (including one retry) 3 - maximum three attempts (default option) :type retries: int :param use_udp: use UDP to connect to InfluxDB, defaults to False :type use_udp: bool :param udp_port: UDP port to connect to InfluxDB, defaults to 4444 :type udp_port: int :param proxies: HTTP(S) proxy to use for Requests, defaults to {} :type proxies: dict :param path: path of InfluxDB on the server to connect, defaults to '' :type path: str :param cert: Path to client certificate information to use for mutual TLS authentication. You can specify a local cert to use as a single file containing the private key and the certificate, or as a tuple of both files’ paths, defaults to None :type cert: str :param gzip: use gzip content encoding to compress requests :type gzip: bool :param session: allow for the new client request to use an existing requests Session, defaults to None :type session: requests.Session :param headers: headers to add to Requests, will add 'Content-Type' and 'Accept' unless these are already present, defaults to {} :type headers: dict :param socket_options: use custom tcp socket options, If not specified, then defaults are loaded from ``HTTPConnection.default_socket_options`` :type socket_options: list :raises ValueError: if cert is provided but ssl is disabled (set to False) � localhost� �rootNF� �\ � � c C sV || _ t|�| _|| _|| _|| _|| _| | _|| _| | _ t|�| _ |sPt�� }|| _ tt| �t| �|d�}| r�t�tjtj�| _|s�d| _n|d dkr�|| _n d| | _d| _|du r�d| _| j �| jd |� |d u r�i | _n|| _|�r|s�td ��n|| j _d�| j| j| j| j�| _|d u �r.i }|�dd � |�dd� || _|| _ d S )z&Construct a new InfluxDBClient object.)�pool_connections�pool_maxsize�socket_optionsr r �/�httpT�httpsz://Nz0Client certificate provided but ssl is disabled.z{0}://{1}:{2}{3}�Content-Typezapplication/json�Accept�application/x-msgpack)!�_InfluxDBClient__host�int�_InfluxDBClient__port� _username� _password� _database�_timeout�_retries�_verify_ssl�_InfluxDBClient__use_udp�_InfluxDBClient__udp_port�requests�Session�_session�_SocketOptionsAdapter�socket�AF_INET� SOCK_DGRAM� udp_socket�_InfluxDBClient__pathZ_scheme�mount�_proxies� ValueError�cert�format�_host�_port�_path�_InfluxDBClient__baseurl� setdefault�_headers�_gzip)�self�host�port�username�password�database�sslZ verify_ssl�timeout�retries�use_udpZudp_port�proxiesZ pool_size�pathr: �gzip�session�headersr �adapter� rS �/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/influxdb/client.py�__init__c sd � �� zInfluxDBClient.__init__c C s | S )z*Enter function as used by context manager.rS �rC rS rS rT � __enter__� s zInfluxDBClient.__enter__c C s | � � dS )z)Exit function as used by context manager.N)�close)rC Z _exc_typeZ _exc_valueZ _tracebackrS rS rT �__exit__� s zInfluxDBClient.__exit__c C s | j S �N)r? rV rS rS rT �_baseurl� s zInfluxDBClient._baseurlc C s | j S rZ )r# rV rS rS rT r<