U vi(h@sdZddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z ddl ZddlmZddlmZddlmZdd lmZdd lmZmZGd 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) ThreadPool)quote) SigninService)SignoutService)rest) Configuration)_requires_create_user_session_requires_expire_user_sessionc@s"eZdZdZeeeeefZ eeeeee j e j e dZ dZd7ddZddZedd Zed d Zejd d Zd dZd8ddZddZddZddZd9ddZd:ddZddZd;ddZd d!Zd"d#Zd$d%Z d&d'Z!d(d)Z"d*d+Z#d,d-Z$d.d/Z%d0d1Z&ed2d3d4Z'd5d6Z(dS)<ApiClientAsyncaxGeneric API client for OpenAPI client library Build. OpenAPI generic API client. This client handles the client- server communication, and is invariant across implementations. Specifics of the methods and models for each application are generated from the OpenAPI templates. NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. :param configuration: .Configuration object for this client :param header_name: a header to pass when making calls to the API. :param header_value: a header value to pass when making calls to the API. :param cookie: a cookie to include in the header when making calls to the API :param pool_threads: The number of threads to use for async requests to the API. More threads means more concurrent API requests. )intlongfloatstrbooldatedatetimeobjectNcKsd|dkrt}||_||_tj|f||_i|_|dk rB||j|<||_ddlm }d||_ dS)zInitialize generic API client.Nr)VERSIONzinfluxdb-client-python/) r configuration pool_threadsrZRESTClientObjectAsync rest_clientdefault_headerscookieinfluxdb_clientr user_agent)selfr header_name header_valuerrkwargsrr R/opt/alt/python38/lib/python3.8/site-packages/influxdb_client/_async/api_client.py__init__As  zApiClientAsync.__init__csB|IdH|jIdH|jr>|j|jd|_dS)zDispose api client.N)_signoutrclose_pooljoinrr r r!r$Rs   zApiClientAsync.closecCs|jdkrt|j|_|jS)z`Create thread pool on first request avoids instantiating unused threadpool for blocking clients.N)r%rrr'r r r!pool\s  zApiClientAsync.poolcCs |jdS)zUser agent for this API client. User-Agentrr'r r r!rcszApiClientAsync.user_agentcCs||jd<dS)z#Set User agent for this API client.r)Nr*rvaluer r r!rhscCs||j|<dS)z$Set HTTP header for this API client.Nr*)rrrr r r!set_default_headermsz!ApiClientAsync.set_default_headerTc s|j}|j|dIdH|pi}|||||j|jrH|j|d<|rf||}t||| }|r||}||| }|D]&\}}| d|t t ||j d}q|r||}||| }|s|r| ||}||}||| }|||| |r||}|||}|jj|}|p.i}|j||f||||| |d|IdH}||_|}| r| r|||| }nd}| dk r|S||j|fSdS)N resource_pathCookiez{%s})safe) query_paramsheaders post_paramsbody_preload_content_request_timeoutF)r_signinZupdate_request_header_paramsupdaterrsanitize_for_serializationdictparameters_to_tuplesreplacerrZsafe_chars_for_path_paramprepare_post_parametersupdate_params_for_authZupdate_request_bodyhostrequestZ last_response deserializestatus getheaders)rr/method path_paramsr2 header_paramsr5r4files response_type auth_settings_return_http_data_onlycollection_formatsr6r7 urlopen_kwconfigkvurlZ response_dataZ return_datar r r!Z __call_apiqs~               zApiClientAsync.__call_apicsdkr dStjrSttr8fddDSttrXtfddDSttjtjfrrSttr}nfddj D}fdd| DS) aBuild a JSON POST object. If obj is None, return None. If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is OpenAPI model, return the properties dict. :param obj: The data to serialize. :return: The serialized form of data. Ncsg|]}|qSr r:.0Zsub_objr'r r! sz=ApiClientAsync.sanitize_for_serialization..c3s|]}|VqdSNrRrSr'r r! sz.cs0i|](\}}t|dk rj|t|qSrV)getattr attribute_map)rTattr_)objr r! sz=ApiClientAsync.sanitize_for_serialization..csi|]\}}||qSr rR)rTkeyvalr'r r!r]s) isinstancePRIMITIVE_TYPESlisttuplerr isoformatr; openapi_typesitems)rr\Zobj_dictr )r\rr!r:s,        z)ApiClientAsync.sanitize_for_serializationcCsJ|dkr||Szt|j}Wntk r<|j}YnX|||S)aDeserializes response into an object. :param response: RESTResponse object to be deserialized. :param response_type: class literal for deserialized object, or string of class name. :return: deserialized object. file)!_ApiClientAsync__deserialize_filejsonloadsdata ValueError_ApiClientAsync__deserialize)rresponserIrkr r r!rBs   zApiClientAsync.deserializecs|dkr dSt|tkr|drHtd|dfdd|DS|dr|td|d fd d |DS|jkrj|}n tt j |}|j kr ||S|t krƈ|S|tjkrڈ|S|tjkr|S||SdS) zDeserializes dict, list, str into an object. :param data: dict, list or str. :param klass: class literal, or string of class name. :return: object. Nzlist[z list\[(.*)\]csg|]}|qSr rm)rTZsub_datarZsub_klsr r!rUsz0ApiClientAsync.__deserialize..zdict(zdict\(([^,]*), (.*)\)csi|]\}}||qSr rp)rTrOrPrqr r!r]sz0ApiClientAsync.__deserialize..)typer startswithrematchgrouprfNATIVE_TYPES_MAPPINGrXrdomainra&_ApiClientAsync__deserialize_primitiver#_ApiClientAsync__deserialize_objectrr!_ApiClientAsync__deserialize_date%_ApiClientAsync__deserialize_datatime"_ApiClientAsync__deserialize_modelrrkklassr rqr!Z __deserializes2               zApiClientAsync.__deserializecCs\| s*|||||||||| | | | |||S|j|j||||||||| | | | |||f}|S)aMake the HTTP request (synchronous) and Return deserialized data. To make an async_req request, set the async_req parameter. :param resource_path: Path to method endpoint. :param method: Method to call. :param path_params: Path parameters in the url. :param query_params: Query parameters in the url. :param header_params: Header parameters to be placed in the request header. :param body: Request body. :param post_params dict: Request post form parameters, for `application/x-www-form-urlencoded`, `multipart/form-data`. :param auth_settings list: Auth Settings names for the request. :param response: Response data type. :param files dict: key -> filename, value -> filepath, for `multipart/form-data`. :param async_req bool: execute request asynchronously :param _return_http_data_only: response data without head status code and headers :param collection_formats: dict of collection formats for path, query, header, and post parameters. :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` :return: If async_req parameter is True, the request will be called asynchronously. The method will return the request thread. If parameter async_req is False or missing, then the method will return the response directly. )_ApiClientAsync__call_apir(Z apply_async)rr/rErFr2rGr5r4rHrIrJZ async_reqrKrLr6r7rMthreadr r r!call_api*sB, zApiClientAsync.call_apic Ks,|dkr&|jj|f||||d| S|dkrL|jj|f||||d| S|dkrv|jj|f||||||d| S|dkr|jj|f||||||d| S|dkr|jj|f||||||d| S|dkr|jj|f||||||d| S|d kr |jj|f|||||d | Std d S) z'Make the HTTP request using RESTClient.GET)r2r6r7r3HEADOPTIONS)r2r3r4r6r7r5POSTPUTPATCHDELETE)r2r3r6r7r5zQhttp method must be `GET`, `HEAD`, `OPTIONS`, `POST`, `PATCH`, `PUT` or `DELETE`.N) rrrrrrrrrl) rrErQr2r3r4r5r6r7rMr r r!rAhs         zApiClientAsync.requestcsg}|dkri}t|tr"|n|D]\}|kr|}|dkr`|fdd|Dq|dkrnd}n |dkr|d}n|d krd }nd }||d d|Dfq&||fq&|S) a Get parameters as list of tuples, formatting collections. :param params: Parameters as dict or list of two-tuples :param dict collection_formats: Parameter collection formats :return: Parameters as list of tuples, collections formatted Nmultic3s|]}|fVqdSrVr rTr,rOr r!rWsz6ApiClientAsync.parameters_to_tuples..Zssv Ztsv Zpipes|,css|]}t|VqdSrV)rrr r r!rWs)r`r;rfextendappendr&)rparamsrL new_paramsrPZcollection_format delimiterr rr!r<s(z#ApiClientAsync.parameters_to_tuplesc Csg}|r |}|r|D]\}}|s&qt|tkr6|n|g}|D]^}t|dJ}tj|j} |} t | dpvd} | t |t | | | ggW5QRXq@q|S)zBuild form parameters. :param post_params: Normal form parameters. :param files: File parameters. :return: Form parameters with files. rbrzapplication/octet-stream) rfrsrbopenospathbasenamenameread mimetypes guess_typerrc) rr4rHrrOrPZ file_namesnffilenameZfiledatamimetyper r r!r>s& z&ApiClientAsync.prepare_post_parameterscCs0|sdSdd|D}d|kr"dSd|SdS)zReturn `Accept` based on an array of accepts provided. :param accepts: List of headers. :return: Accept (e.g. application/json). NcSsg|] }|qSr lowerrTxr r r!rUsz7ApiClientAsync.select_header_accept..application/jsonz, )r&)rZacceptsr r r!select_header_accepts z#ApiClientAsync.select_header_acceptcCs6|sdSdd|D}d|ks&d|kr*dS|dSdS)zReturn `Content-Type` based on an array of content_types provided. :param content_types: List of content-types. :return: Content-Type (e.g. application/json). rcSsg|] }|qSr rrr r r!rUsz=ApiClientAsync.select_header_content_type..z*/*rNr )rZ content_typesr r r!select_header_content_types z)ApiClientAsync.select_header_content_typecCs|sdS|D]n}|j|}|r |ds0q q |ddkrN|d||d<q |ddkrr||d|dfq tdq dS)aUpdate header and query params based on authentication setting. :param headers: Header parameters dict to be updated. :param querys: Query parameters tuple list to be updated. :param auth_settings: Authentication setting identifiers list. Nr,inheaderr^queryz3Authentication token must be in `query` or `header`)rrJgetrrl)rr3ZquerysrJauthZ auth_settingr r r!r?s  z%ApiClientAsync.update_params_for_authc Cstj|jjd\}}t|t||d}|r^t d| d}tj tj ||}t|d}||jW5QRX|S)zDeserializes body to file. Saves response body into a file in a temporary folder, using the filename from the `Content-Disposition` header if provided. :param response: RESTResponse. :return: file path. )dirzContent-Dispositionz filename=[\'"]?([^\'"\s]+)[\'"]?rowb)tempfilemkstemprZtemp_folder_pathrr$remove getheaderrusearchrwrr&dirnamerwriterk)rrnfdrcontent_dispositionrrr r r!Z__deserialize_files     z!ApiClientAsync.__deserialize_filecCsBz ||WStk r&t|YStk r<|YSXdS)zDeserializes string to primitive type. :param data: str. :param klass: class literal. :return: int, long, float, str, bool. N)UnicodeEncodeErrorr TypeErrorrr r r!Z__deserialize_primitive6s   z&ApiClientAsync.__deserialize_primitivecCs|S)zrrr?rhrzr{r|r}r~r8r#r r r r!r s       R*( > D r )r __future__rrrirrrurZmultiprocessing.poolr urllib.parserZinfluxdb_client.domainrrrZinfluxdb_client._asyncrZinfluxdb_client.configurationrZinfluxdb_client.restr r rr r r r r!s