U vi;@sdZddlmZddlZddlZddlZddlZddlmZddl m Z ddl m Z z ddl Z Wne k r|e dYnXGdd d ejZGd d d eZdS) a InfluxDB OSS API Service. The InfluxDB v2 API provides a programmatic interface for all interactions with InfluxDB. Access the InfluxDB API using the `/api/v2/` endpoint. # noqa: E501 OpenAPI spec version: 2.0.0 Generated by: https://openapi-generator.tech )absolute_importN) urlencode) ApiException)_BaseRESTClientz'OpenAPI Python client requires urllib3.c@s*eZdZdZddZddZd ddZdS) RESTResponseNOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. cCs"||_|j|_|j|_|j|_dS)zInitialize with HTTP response.N)urllib3_responsestatusreasondata)selfresprK/opt/alt/python38/lib/python3.8/site-packages/influxdb_client/_sync/rest.py__init__%szRESTResponse.__init__cCs|jjS)z,Return a dictionary of the response headers.)rheaders)r rrr getheaders,szRESTResponse.getheadersNcCs|jj||S)zReturn a given response header.)rrget)r namedefaultrrr getheader0szRESTResponse.getheader)N)__name__ __module__ __qualname____doc__rrrrrrrrsrc@szeZdZdZdddZddd Zdd d Zdd d Zd ddZd!ddZ d"ddZ d#ddZ d$ddZ ddZ ddZdS)%RESTClientObjectrNFc Cs||_||_||_||_|jr&tj}ntj}|jr:|j}nd}i}|j dk rV|j |d<|j|d<|dkr~|j dk rz|j }nd}|j rt j f|||||j|j|j|j |j|jd ||_n,t jf|||||j|j|j|jd||_dS)zInitialize REST client.Nassert_hostnameretriesr) num_poolsmaxsize cert_reqsca_certs cert_filekey_file key_password proxy_url proxy_headers ssl_context)rr r!r"r#r$r%r() configuration pools_sizer rZ verify_sslssl CERT_REQUIRED CERT_NONEZ ssl_ca_certrZconnection_pool_maxsizeproxyurllib3 ProxyManagerr#Z cert_key_fileZcert_key_passwordr'r( pool_manager PoolManager)r r)r*r rr!r"Zaddition_pool_argsrrrr<sZ       zRESTClientObject.__init__Tc  Ks0|}|dkst|r$|r$td|p*i}|p2i}d} |pB|jj} | rt| ttfrhtj | dd} n4t| t rt | dkrtj | dd| ddd } d |krd |d <|jj rt |||dkrd n d t|t |dt |dzN|dkr"|r|d t|7}td|d tjrhd} |dk rFt|} |jj||f| || |d| } n|d dkr|jj||f|d|| |d| } n|d dkr|d =|jj||f|d|| |d| } nNt|tst|tr|} |jj||f| || |d| } nd}td|dn |jj||f||| |d| } WnJtjjk r}z&dt|j t|}td|dW5d}~XYnX|rt!| } | j"#d| _"|jj rt $| j%t&| drt | j'dt&| drt | j(j'dt | j"dd| j%kr d ks,nt| d!| S)"a9Perform requests. :param method: http request method :param url: http request url :param query_params: query parameters in the url :param headers: http request headers :param body: request json body, for `application/json` :param post_params: request post parameters, `application/x-www-form-urlencoded` and `multipart/form-data` :param _preload_content: if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True. :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. :param urlopen_kw: Additional parameters are passed to :meth:`urllib3.request.RequestMethods.request` )GETHEADDELETEPOSTPUTPATCHOPTIONSz9body parameter cannot be used with post_params parameter.Ni)totalr)connectreadz Content-Typezapplication/json?z>>>)r6r7r8r9r5json)bodypreload_contenttimeoutrz!application/x-www-form-urlencodedF)fieldsencode_multipartrCrDrzmultipart/form-dataTzCannot prepare a request message for provided arguments. Please check that your arguments match declared content type.)r r )rErCrDrz{0} {1}utf8rz<<s