o
    ?Hhj1                     @   s   d Z ddlZddlZddlZddlZddlZddlmZmZ ddl	Z	ddl
mZmZmZmZmZmZ eeZG dd dejZG dd deZdS )	a  
    LINE Messaging API(Insight)

    This document describes LINE Messaging API(Insight).  # noqa: E501

    The version of the OpenAPI document: 0.0.1
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
    N)	urlencode
quote_plus)ApiExceptionUnauthorizedExceptionForbiddenExceptionNotFoundExceptionServiceExceptionApiValueErrorc                   @   s&   e Zd Zdd Zdd ZdddZdS )	RESTResponsec                 C   s"   || _ |j| _|j| _|j| _d S N)urllib3_responsestatusreasondata)selfresp r   W/home/air/sanwanet/gpt-api/venv/lib/python3.10/site-packages/linebot/v3/insight/rest.py__init__    s   zRESTResponse.__init__c                 C   s   | j jS )z-Returns a dictionary of the response headers.)r   headers)r   r   r   r   
getheaders&   s   zRESTResponse.getheadersNc                 C   s   | j j||S )z Returns a given response header.)r   r   get)r   namedefaultr   r   r   	getheader*   s   zRESTResponse.getheaderr   )__name__
__module____qualname__r   r   r   r   r   r   r   r
      s    r
   c                   @   s   e Zd ZdddZ			dddZ		ddd	Z		dd
dZ		dddZ		dddZ		dddZ			dddZ
		dddZdS )RESTClientObject   Nc                 C   s   |j rtj}ntj}i }|jd ur|j|d< |jd ur |j|d< |jd ur*|j|d< |d u r9|jd ur7|j}nd}|jrUt	j
d||||j|j|j|j|jd|| _d S t	jd||||j|j|jd|| _d S )Nassert_hostnameretriessocket_optionsr   )	num_poolsmaxsize	cert_reqsca_certs	cert_filekey_file	proxy_urlproxy_headers)r#   r$   r%   r&   r'   r(   r   )
verify_sslsslCERT_REQUIRED	CERT_NONEr    r!   r"   connection_pool_maxsizeproxyurllib3ProxyManagerssl_ca_certr'   r(   r*   pool_managerPoolManager)r   configuration
pools_sizer$   r%   addition_pool_argsr   r   r   r   1   sJ   






	zRESTClientObject.__init__Tc	              
   C   s  |  }|dv s
J |r|rtd|pi }|pi }i }d}	|rDt|ttfr.tj|d}	nt|trDt|dkrDtj|d |d d}	z|d	v r|	d
rXt
d|d
 t
jrpd}
|durct|}
| jj|||
||	|d}nX|d
 dkr| jj|||d||	|d}nD|d
 dkr|d
= | jj|||d||	|d}n-t|tst|tr|}
| jj|||
||	|d}nd}td|d| jj||i ||	|d}W n tjjy } zdt|jt|}td|dd}~ww |rt|}td|j d|j  krdks>n |jdkrt|d|jdkrt|d|jdkr%t |dd|j  kr2dkr9n nt!|dt|d|S )a  Perform 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.
        )GETHEADDELETEPOSTPUTPATCHOPTIONSz9body parameter cannot be used with post_params parameter.N)total   r      )connectread)r<   r=   r>   r?   r;   zContent-Typejson)bodypreload_contenttimeoutr   z!application/x-www-form-urlencodedF)fieldsencode_multipartrG   rH   r   zmultipart/form-dataTzCannot prepare a request message for provided
                             arguments. Please check that your arguments match
                             declared content type.)r   r   )rI   rG   rH   r   z{0}
{1}zresponse body: %s   i+  i  )	http_respi  i  i  iW  )"upperr	   
isinstanceintfloatr1   Timeouttuplelenr   research
IGNORECASErE   dumpsr4   requeststrbytesr   
exceptionsSSLErrorformattyper   r
   loggerdebugr   r   r   r   r   r   )r   methodurlquery_paramsr   rF   post_params_preload_content_request_timeoutrH   request_bodyrmsger   r   r   rX   f   s   








zRESTClientObject.requestc                 C      | j d|||||dS )Nr9   r   re   rf   rc   rX   r   rb   r   rc   re   rf   r   r   r   get_request      zRESTClientObject.get_requestc                 C   rk   )Nr:   rl   rm   rn   r   r   r   head_request   rp   zRESTClientObject.head_requestc              
   C      | j d|||||||dS )Nr?   r   rc   rd   re   rf   rF   rm   r   rb   r   rc   rd   rF   re   rf   r   r   r   options_request      z RESTClientObject.options_requestc              	   C   s   | j d||||||dS )Nr;   )r   rc   re   rf   rF   rm   )r   rb   r   rc   rF   re   rf   r   r   r   delete_request  s   zRESTClientObject.delete_requestc              
   C   rr   )Nr<   rs   rm   rt   r   r   r   post_request  rv   zRESTClientObject.post_requestc              
   C   rr   )Nr=   rs   rm   rt   r   r   r   put_request  rv   zRESTClientObject.put_requestc              
   C   rr   )Nr>   rs   rm   rt   r   r   r   patch_request   rv   zRESTClientObject.patch_request)r   N)NNNNTN)NNTN)NNNTN)r   r   r   r   rX   ro   rq   ru   rw   rx   ry   rz   r   r   r   r   r   /   s8    
5
 




	



r   )__doc__iorE   loggingrT   r,   urllib.parser   r   r1   linebot.v3.insight.exceptionsr   r   r   r   r   r	   	getLoggerr   r_   IOBaser
   objectr   r   r   r   r   <module>   s    
