HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/1991108/root/usr/lib/python3/dist-packages/acme/__pycache__/
Upload File :
Current File : //proc/1991108/root/usr/lib/python3/dist-packages/acme/__pycache__/client.cpython-311.pyc
�

E��csu��z�dZddlZddlZddlmZddlmZddlZddl	Z	ddl
Z
ddlmZddlm
Z
ddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZddlZddlZddlZdd
lmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ej#e$��Z%dZ&Gd�d��Z'Gd�d��Z(dS)zACME client API.�N)�parsedate_tz)�Any)�cast)�List)�Mapping)�Optional)�Set)�Text)�Tuple)�Union)�HTTPAdapter)�parse_header_links)�
challenges)�crypto_util)�errors)�jws)�messages�-c
�\�eZdZdZdejddddfd�Zdejdejfd	�Z	d
ejdejfd�Z
	d6d
ejdeejdejfd
�Z
d7d
ejdedejfd�Zdedejfd�Zdejdeejejffd�Z	d6dejdeejdejfd�Zdejdejdejfd�Z	d7dejdejdedejfd�Zdejdeddfd�Zdefd�Z de!d e!dejfd!�Z"d"ejd#e#de$e#fd$�Z%e&d%e#dddejfd&���Z'e&		d8d"ejd'ee#d(ee#dejfd)���Z(d
ejd*ejdejfd+�Z)de!d e!dejfd,�Z*d
ejdejfd-�Z+dejdejfd.�Z,		d8d"ejd/eej-d'ee#dejfd0�Z.d1ej/d"e0j1dej2fd2�Z3e&d"ejd3edejfd4���Z4dejded%e#ddfd5�Z5dS)9�ClientV2zuACME client for a v2 API.

    :ivar messages.Directory directory:
    :ivar .ClientNetwork net: Client network.
    �	directory�net�
ClientNetwork�returnNc�"�||_||_dS)z�Initialize.

        :param .messages.Directory directory: Directory Resource
        :param .ClientNetwork net: Client network.
        N)rr)�selfrrs   �-/usr/lib/python3/dist-packages/acme/client.py�__init__zClientV2.__init__+s��#���������new_accountc���|�|jd|��}|jdkr(d|jvrt	j|jd���|�|��}||j_|S)z�Register.

        :param .NewRegistration new_account:

        :raises .ConflictError: in case the account already exists

        :returns: Registration Resource.
        :rtype: `.RegistrationResource`
        �
newAccount���Location)	�_postr�status_code�headersr�
ConflictError�_regr_from_responser�account)rr �response�regrs    rr zClientV2.new_account4st���:�:�d�n�\�:�K�H�H����3�&�&�:��9I�+I�+I��&�x�'7�
�'C�D�D�D��'�'��1�1�������rr,c�Z�|�|d��|j_|jjS)z�Query server about registration.

        :param messages.RegistrationResource regr: Existing Registration
            Resource.

        T)�_get_v2_accountrr*�rr,s  r�query_registrationzClientV2.query_registrationGs)�� �/�/��d�;�;�����x��r�updatec���|�|��}|�|jn|}tjdit	|����}|�||���}||j_|S)aKUpdate registration.

        :param messages.RegistrationResource regr: Registration Resource.
        :param messages.Registration update: Updated body of the
            resource. If not provided, body will be taken from `regr`.

        :returns: Updated Registration Resource.
        :rtype: `.RegistrationResource`

        N)�body�)r.r3r�UpdateRegistration�dict�_send_recv_regrrr*)rr,r1r3�updated_regrs     r�update_registrationzClientV2.update_registrationSsj���#�#�D�)�)��$�n����&���*�:�:�T�&�\�\�:�:���+�+�D�t�+�<�<��'�����rF�update_bodyc�f�d|j_|j�d���}|�|jd|��}|jd}|�|r1tj�	|�
����n|j|���}||j_|S)NT)�only_return_existingr"r$�r3�uri)rr*r3r1r%rr'r�Registration�	from_json�json)rr,r:�only_existing_regr+�updated_uri�new_regrs       rr.zClientV2._get_v2_accountis������� �I�,�,�$�,�G�G���:�:�d�n�\�:�<M�N�N���&�z�2���;�;�"-�%=�H�$9�$C�$C�H�M�M�O�O�$T�$T�$T�37�9�#.��0�0��$�����r�csr_pemc�T�tj�tjj|��}t	j|��}t	j|��}g}|D]5}|�tj	tj
|������6|D]5}|�tj	tj|������6tj|���}|�
|jd|��}	tj�|	�����}
g}|
jD]?}|�|�|�|��|������@tj|
|	j�d��||���S)z�Request a new Order object from the server.

        :param bytes csr_pem: A CSR in PEM format.

        :returns: The newly created order.
        :rtype: OrderResource
        )�typ�value)�identifiers�newOrder�r>r$)r3r>�authorizationsrE)�OpenSSL�crypto�load_certificate_request�FILETYPE_PEMr� _pyopenssl_cert_or_req_all_names�_pyopenssl_cert_or_req_san_ip�appendr�
Identifier�IDENTIFIER_FQDN�
IDENTIFIER_IP�NewOrderr%r�Orderr@rArL�_authzr_from_response�_post_as_get�
OrderResourcer'�get)
rrE�csr�dnsNames�ipNamesrI�name�ips�orderr+r3rL�urls
             r�	new_orderzClientV2.new_orderus����n�5�5�g�n�6Q�SZ�[�[���?��D�D���;�C�@�@�����	�	�D����x�2�x�7O�� � � �
�
�
�
��	�	�C����x�2�x�7M�� � � �
�
�
�
��!�k�:�:�:���:�:�d�n�Z�8�%�@�@���~�'�'��
�
���8�8�����&�	_�	_�C��!�!�$�"<�"<�T�=N�=N�s�=S�=S�Y\�"<�"]�"]�^�^�^�^��%��� �$�$�Z�0�0�)��	���	r�authzrc��|�|j��}|�||jj|j��}||fS)aPoll Authorization Resource for status.

        :param authzr: Authorization Resource
        :type authzr: `.AuthorizationResource`

        :returns: Updated Authorization Resource and HTTP response.

        :rtype: (`.AuthorizationResource`, `requests.Response`)

        )rZr>rYr3�
identifier)rrer+�updated_authzrs    r�pollz
ClientV2.poll�sG���$�$�V�Z�0�0���3�3��f�k�,�f�j�:�:���x�'�'r�orderr�deadlinec���|�4tj���tjd���z}|�||��}|�||��S)adPoll authorizations and finalize the order.

        If no deadline is provided, this method will timeout after 90
        seconds.

        :param messages.OrderResource orderr: order to finalize
        :param datetime.datetime deadline: when to stop polling and timeout

        :returns: finalized order
        :rtype: messages.OrderResource

        N�Z��seconds)�datetime�now�	timedelta�poll_authorizations�finalize_order)rrjrks   r�poll_and_finalizezClientV2.poll_and_finalize�s\�����(�,�,�.�.��1C�B�1O�1O�1O�O�H��)�)�&�(�;�;���"�"�6�8�4�4�4rc���g}|jjD]�}tj���|kr�|�|�|��|���}|jjtjkr|�	|��n6tjd��tj���|k����t|��t|jj��krtj���g}|D]G}|jjtjkr+|jjD]}|j�|�	|����H|rtj|���|�|���S)zPoll Order Resource for status.rK�N)rL)r3rLrprqrYrZ�statusr�STATUS_PENDINGrS�time�sleep�lenr�TimeoutError�STATUS_VALIDr�error�ValidationErrorr1)rrjrk�	responsesrcre�failed�challs        rrszClientV2.poll_authorizations�se���	��;�-�	�	�C��#�'�'�)�)�H�4�4��3�3�D�4E�4E�c�4J�4J�PS�3�T�T���;�%��)@�@�@��$�$�V�,�,�,���
�1�
�
�
��#�'�'�)�)�H�4�4���y�>�>�C��� :�;�;�;�;��%�'�'�'����	.�	.�F��{�!�X�%:�:�:�#�[�3�.�.�E��{�.��
�
�f�-�-�-����	1��(��0�0�0��}�}�I�}�6�6�6r�fetch_alternative_chainsc���tj�tjj|j��}tjtj|�����}��	|j
j|��tj�
��|k�r[tjd����|j��}t
j�|�����}|jt
jkr4|j�t1j|j���t1jd���|jt
jkr{|j�t��|j��}|�||j���}|r:��|d��}	�fd�|	D��}
|�|
���}|Stj�
��|k��[t1j ���)	a{Finalize an order and obtain a certificate.

        :param messages.OrderResource orderr: order to finalize
        :param datetime.datetime deadline: when to stop polling and timeout
        :param bool fetch_alternative_chains: whether to also fetch alternative
            certificate chains

        :returns: finalized order
        :rtype: messages.OrderResource

        )r]rwNzPThe certificate order failed. No further information was provided by the server.)r3�
fullchain_pem�	alternatec�D��g|]}��|��j��Sr4)rZ�text)�.0rcrs  �r�
<listcomp>z+ClientV2.finalize_order.<locals>.<listcomp>�s*���!Y�!Y�!Y�#�$�"3�"3�C�"8�"8�"=�!Y�!Y�!Yr)�alternative_fullchains_pem)!rMrNrOrPrEr�CertificateRequest�jose�ComparableX509r%r3�finalizerprqrzr{rZr>rXr@rArx�STATUS_INVALIDrr�
IssuanceError�Errorr~�certificater1r��
_get_linksr})rrjrkr�r]�wrapped_csrr+r3�certificate_response�alt_chains_urls�
alt_chainss`          rrtzClientV2.finalize_order�s�����n�5�5��N�'���9�9���1�d�6I�#�6N�6N�O�O�O���
�
�6�;�'��5�5�5���#�#�%�%��0�0��J�q�M�M�M��(�(���4�4�H��>�+�+�H�M�M�O�O�<�<�D��{�h�5�5�5��:�)� �.�t�z�:�:�:��l�%�&�&�&���� 5�5�5�$�:J�:V�'+�'8�'8��9I�'J�'J�$����D�@T�@Y��Z�Z��+�R�&*�o�o�6J�K�&X�&X�O�!Y�!Y�!Y�!Y��!Y�!Y�!Y�J�#�]�]�j�]�Q�Q�F��
�#��#�#�%�%��0�0�$�!�#�#�#r�cert�rsnc�J�|�|||jd��dS)aRevoke certificate.

        :param .ComparableX509 cert: `OpenSSL.crypto.X509` wrapped in
            `.ComparableX509`

        :param int rsn: Reason code for certificate revocation.

        :raises .ClientError: If revocation is unsuccessful.

        �
revokeCertN)�_revoker)rr�r�s   r�revokezClientV2.revoke�s'��	
���T�3���|� <�=�=�=�=�=rc��t|jd��o*t|jjd��o|jjjS)zGChecks if ACME server requires External Account Binding authentication.�meta�external_account_required)�hasattrrr�r��rs rr�z"ClientV2.external_account_requireds>���t�~�v�.�.�=��t�~�*�,G�H�H�=��~�"�<�	=r�args�kwargsc�L�|dd�dz|dd�z}|j|i|��S)z
        Send GET request using the POST-as-GET protocol.
        :param args:
        :param kwargs:
        :return:
        Nrw�N)r%)rr�r��new_argss    rrZzClientV2._post_as_get
s:������8�g�%��Q�R�R��0���t�z�8�.�v�.�.�.rr+�
relation_typec�j��d|jvrgSt|jd��}�fd�|D��S)z�
        Retrieves all Link URIs of relation_type from the response.
        :param requests.Response response: The requests HTTP response.
        :param str relation_type: The relation type to filter by.
        �Linkc�H��g|]}d|v�d|v�
|d�k�|d��S)�relrcr4)r��lr�s  �rr�z'ClientV2._get_links.<locals>.<listcomp>"sH���L�L�L�Q��A�:�:�%�1�*�*��5��]�1J�1J��%��1J�1J�1Jr)r'r)rr+r��linkss  ` rr�zClientV2._get_linkss_�����)�)�)��I�"�8�#3�F�#;�<�<��L�L�L�L�%�L�L�L�	Lrrcc��tj�|�|�������S)aB
        Retrieves the ACME directory (RFC 8555 section 7.1.1) from the ACME server.
        :param str url: the URL where the ACME directory is available
        :param ClientNetwork net: the ClientNetwork to use to make the request

        :returns: the ACME directory object
        :rtype: messages.Directory
        )r�	Directoryr@r\rA)�clsrcrs   r�
get_directoryzClientV2.get_directory%s1���!�+�+�C�G�G�C�L�L�,=�,=�,?�,?�@�@�@rr>�terms_of_servicec��d|jvr|jdd}tjtj�|�����|j�d|��|���S)Nzterms-of-servicercr$)r3r>r�)r�r�RegistrationResourcer?r@rAr'r\)r�r+r>r�s    rr)zClientV2._regr_from_response1ss�����/�/�'�~�.@�A�%�H���,��&�0�0������A�A�� �$�$�Z��5�5�-�/�/�/�	/rr3c�|�|�|j|��}|�||j|j���S)N)r>r�)r%r>r)r�)rr,r3r+s    rr7zClientV2._send_recv_regr=sC���:�:�d�h��-�-���'�'��$�(�!�2�(�4�4�	4rc�x�|�dt|jd����|jj|i|��S)z�Wrapper around self.net.post that adds the newNonce URL.

        This is used to retry the request in case of a badNonce error.

        �
new_nonce_url�newNonce)�
setdefault�getattrrr�post�rr�r�s   rr%zClientV2._postKs?��	���/�7�4�>�:�+N�+N�O�O�O��t�x�}�d�-�f�-�-�-rc�n�|�|tj�ddd�����S)z�Deactivate registration.

        :param messages.RegistrationResource regr: The Registration Resource
            to be deactivated.

        :returns: The Registration resource that was deactivated.
        :rtype: `.RegistrationResource`

        �deactivatedN)rx�contact)r9rr?r@r/s  r�deactivate_registrationz ClientV2.deactivate_registrationTs>���'�'��h�.C�.M�.M�$��6�6�/8�/8�9�9�	9rc��tjd���}|�|j|��}|�||jj|j��S)aDeactivate authorization.

        :param messages.AuthorizationResource authzr: The Authorization resource
            to be deactivated.

        :returns: The Authorization resource that was deactivated.
        :rtype: `.AuthorizationResource`

        r�)rx)r�UpdateAuthorizationr%r>rYr3rg)rrer3r+s    r�deactivate_authorizationz!ClientV2.deactivate_authorizationbsR���+�=�A�A�A���:�:�f�j�$�/�/���)�)�(��K�"�F�J�0�0�	0rrgc��tjtj�|�����|j�d|�����}|�$|jj|krtj
|���|S)Nr$r=)r�AuthorizationResource�
Authorizationr@rAr'r\r3rgr�UnexpectedUpdate)rr+rgr>res     rrYzClientV2._authzr_from_responsessz���/��'�1�1�(�-�-�/�/�B�B�� �$�$�Z��5�5�7�7�7���!�f�k�&<�
�&J�&J��)�&�1�1�1��
r�challbc��|�|j|��}	|jdd}n"#t$rt	jd���wxYwt
j|tj�	|�
�������}|j|jkrt	j|j���|S)ahAnswer challenge.

        :param challb: Challenge Resource body.
        :type challb: `.ChallengeBody`

        :param response: Corresponding Challenge response
        :type response: `.challenges.ChallengeResponse`

        :returns: Challenge Resource with updated body.
        :rtype: `.ChallengeResource`

        :raises .UnexpectedUpdate:

        �uprcz"up" Link header missing)�
authzr_urir3)r%r>r��KeyErrorr�ClientErrorr�ChallengeResource�
ChallengeBodyr@rAr�)rr�r+�respr��challrs      r�answer_challengezClientV2.answer_challenge}s��� �z�z�&�*�h�/�/��	A���D�)�%�0�J�J���	A�	A�	A��$�%?�@�@�@�	A�����+�!��'�1�1�$�)�)�+�+�>�>�@�@�@���:���#�#��)�&�*�5�5�5��
s	�1�A�defaultc���|j�dt|����}	t|��}nz#t$rmt|��}|�W	t
j|d�|dnd��}t
j|dd��|z
cYS#ttf$rYnwxYw|}YnwxYwtj�	��t
j|���zS)a�Compute next `poll` time based on response ``Retry-After`` header.

        Handles integers and various datestring formats per
        https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.37

        :param requests.Response response: Response from `poll`.
        :param int default: Default value (in seconds), used when
            ``Retry-After`` header is not present or invalid.

        :returns: Time point when next `poll` should be performed.
        :rtype: `datetime.datetime`

        zRetry-AfterN���r�rn)
r'r\�str�int�
ValueErrorrrprr�
OverflowErrorrq)r�r+r��retry_afterro�when�tz_secss       rr�zClientV2.retry_after�s���&�*�*�=�#�g�,�,�G�G��	��+�&�&�G�G���
	�
	�
	� ��,�,�D����&�0�T�"�X�=Q��b���WX�Y�Y�G�#�,�d�2�A�2�h�7�'�A�A�A�A��"�M�2�����D������G�G�G�
	����� �$�$�&�&��);�G�)L�)L�)L�L�Ls3�:�B1�<B�B1�B)�&B1�(B)�)B1�0B1c��|�|tj||�����}|jtjkrt
jd���dS)a.Revoke certificate.

        :param .ComparableX509 cert: `OpenSSL.crypto.X509` wrapped in
            `.ComparableX509`

        :param int rsn: Reason code for certificate revocation.

        :param str url: ACME URL to post to

        :raises .ClientError: If revocation is unsuccessful.

        )r��reasonz0Successful revocation must return HTTP OK statusN)r%r�
Revocationr&�http_client�OKrr�)rr�r�rcr+s     rr�zClientV2._revoke�si���:�:�c�&�1�,0�'*�,�,�,�-�-����;�>�1�1��$�B�D�D�
D�2�1rr�)F)NN)6�__name__�
__module__�__qualname__�__doc__rr�r�NewRegistrationr�r r0rr?r9�boolr.�bytesr[rdr�r�requests�Responserirprursrtr�r�r�r�r�rrZr�rr��classmethodr�r)r7r%r�r�rTrYr�r�ChallengeResponser�r�r�r�r4rrrr$s+���������(�"4��?��t������x�'?��H�Da�����&
 �x�'D�
 � (� =�
 �
 �
 �
 �GK����(E��$,�X�-B�$C��!)�!>�����,
�
�H�$A�
�PT�
�$�9�
�
�
�
�!��!�8�+A�!�!�!�!�F(�8�9�(���6��8I�I�J�(�(�(�(�$CG�5�5��(>�5�$,�X�->�$?�5�KS�Ka�5�5�5�5�&7�(�*@�7�H�L]�7�!)�!7�7�7�7�7�49>�#$�#$�X�%;�#$�x�GX�#$�15�#$�BJ�BX�#$�#$�#$�#$�J>�4�.�>�S�>�T�>�>�>�>�=�4�=�=�=�=�/�#�/��/��9J�/�/�/�/�L�8�#4�L�S�L�T�RU�Y�L�L�L�L��	A��	A�/�	A�h�>P�	A�	A�	A��[�	A��SW�>B�	/�	/�8�+<�	/�8�C�=�	/�.6�s�m�	/�!)�!>�	/�	/�	/��[�	/�4�H�$A�4�&�3�4�8@�8U�4�4�4�4�.�3�.�#�.�(�2C�.�.�.�.�9�H�,I�9�%-�%B�9�9�9�9�0�)1�)G�0�&.�&D�0�0�0�0�$KO�37���h�.?��*2�8�3F�*G��#+�C�=��<D�<Z������x�'=��#-�#?��DL�D^�����:�M�8�#4�M�s�M�x�GX�M�M�M��[�M�>D�D�/�D�c�D��D��D�D�D�D�D�Drrc���eZdZdZdZdZdZdZ	dej	dde
fd	ejd
ee
jdejded
ededdfd�Zd$d�Zdejdededefd�Ze	d%dejdeedejfd���Zdededededejf
d�Zdededejfd�Zefdedededejfd�Zdejddfd�Zded edefd!�Z dededejfd"�Z!efdedejdededejf
d#�Z"dS)&rzvWrapper around requests that signs POSTs for authentication.

    Also adds user agent, and handles Content-Type.
    zapplication/jsonzapplication/jose+jsonzapplication/problem+jsonzReplay-NonceNTzacme-python�keyr*�alg�
verify_ssl�
user_agent�timeoutrc�8�||_||_||_||_t	��|_||_tj��|_	||_
t��}|j	�d|��|j	�d|��dS)Nzhttp://zhttps://)
r�r*r�r��set�_noncesr�r��Session�session�_default_timeoutr
�mount)rr�r*r�r�r�r��adapters        rrzClientNetwork.__init__�s������������$���"%�%�%���$����'�)�)��� '����-�-������9�g�.�.�.�����:�w�/�/�/�/�/rc�\�	|j���dS#t$rYdSwxYwr�)r��close�	Exceptionr�s r�__del__zClientNetwork.__del__�sC��	��L��� � � � � ���	�	�	��D�D�	���s��
+�+�obj�noncercc	��|r(|�d������nd}t�d|��|j||d�}|j�|jd|d<|j|d	<tjj	|fittttf|�����d���S)
z�Wrap `JSONDeSerializable` object in JWS.

        .. todo:: Implement ``acmePath``.

        :param josepy.JSONDeSerializable obj:
        :param str url: The URL to which this object will be POSTed
        :param str nonce:
        :rtype: str

        �)�indentrzJWS payload:
%s)r�rrcNr>�kidr�)�
json_dumps�encode�logger�debugr�r*r�r�JWS�signrrr�r)rrrrc�jobjr�s      r�_wrap_in_jwszClientNetwork._wrap_in_jws�s���58�@�s�~�~�Q�~�'�'�.�.�0�0�0�S�����'��.�.�.��8���
�
���<�#� �L��/�F�5�M����u�
��w�|�D�D�D�D���c��):�F�$C�$C�D�D�O�O�WX�O�Y�Y�Yrr+�content_typec��|j�d��}|r-|�d��d���}	|���}n#t
$rd}YnwxYw|jdkr-tj|j�dd�����|j	s�|�s||j
krt�d|��	tj�|���#t j$r}tj||f���d}~wwxYwtj|���|�&||jkrt�d	|��||jkr|�tjd
|�����|S)a�Check response content and its type.

        .. note::
           Checking is not strict: wrong server response ``Content-Type``
           HTTP header is ignored if response is an expected JSON object
           (c.f. Boulder #56).

        :param str content_type: Expected Content-Type response header.
            If JSON is expected and not present in server response, this
            function will raise an error. Otherwise, wrong Content-Type
            is ignored, but logged.

        :raises .messages.Error: If server response body
            carries HTTP Problem (https://datatracker.ietf.org/doc/html/rfc7807).
        :raises .ClientError: In case of other networking errors.

        �Content-Type�;rNi�r$zUNKNOWN-LOCATIONz/Ignoring wrong Content-Type (%r) for JSON Errorz<Ignoring wrong Content-Type (%r) for JSON decodable responsez"Unexpected response Content-Type: )r'r\�split�striprAr�r&rr(�ok�JSON_ERROR_CONTENT_TYPErrrr�r@r��DeserializationErrorr��JSON_CONTENT_TYPE)r�r+r�response_ctrrs      r�_check_responsezClientNetwork._check_responses���(�&�*�*�>�:�:���	<�%�+�+�C�0�0��3�9�9�;�;�K�	��=�=�?�?�D�D���	�	�	��D�D�D�	������3�&�&��&�x�'7�';�';�J�HZ�'[�'[�\�\�\��{�	]����#�"=�=�=��L�L�I�#�%�%�%�@�"�.�2�2�4�8�8�8���0�@�@�@� �,�h��->�?�?�?�����@����
�(��2�2�2���K�3�3H�$H�$H����� +�-�-�-��s�4�4�4����(�)[�k�)[�)[�\�\�\��s*�A � A/�.A/�C9�9D#�D�D#�methodr�r�c	�r�|dkr#t�d||d��nt�d||��|j|d<|�di��|d�d|j��|�d|j��	|jj||g|�Ri|��}nt#tj	j
$r]}	d	}tj|t|����}|��|���\}	}
}}td|	�|
�d|�����d
}~wwxYwd
|dvrt!j|j��}
nd|_|j}
t�d|jd�d�|j���D����|
��|S)a�Send HTTP request.

        Makes sure that `verify_ssl` is respected. Logs request and
        response (with headers). For allowed parameters please see
        `requests.request`.

        :param str method: method for the new `requests.Request` object
        :param str url: URL for the new `requests.Request` object

        :raises requests.exceptions.RequestException: in case of any problems

        :returns: HTTP Response
        :rtype: `requests.Response`


        �POSTzSending POST request to %s:
%s�datazSending %s request to %s.�verifyr'z
User-Agentr�zT.*host='(\S*)'.*Max retries exceeded with url\: (\/\w*).*(\[Errno \d+\])([A-Za-z ]*)NzRequesting �:�Acceptzutf-8z!Received response:
HTTP %d
%s

%s�
c3�HK�|]\}}d�||��V��dS)z{0}: {1}N)�format)r��k�vs   r�	<genexpr>z.ClientNetwork._send_request.<locals>.<genexpr>�sR����F�F�$(�A�q� *�0�0��A�6�6�F�F�F�F�F�Fr)rrr�r�r�r�r��requestr��
exceptions�RequestException�re�matchr��groupsr��base64�	b64encode�content�encodingr�r&�joinr'�items)rrrcr�r�r+�e�	err_regex�m�host�path�_err_no�err_msg�
debug_contents              r�
_send_requestzClientNetwork._send_requestQs��"�V����L�L�:��v�f�~�
/�
/�
/�
/�
�L�L�4�f�c�B�B�B��?��x�����)�R�(�(�(��y��$�$�\�4�?�C�C�C����)�T�%:�;�;�;�	C�+�t�|�+�F�C�I�$�I�I�I�&�I�I�H�H���"�3�	C�	C�	C�
/�p�I����C��F�F�+�+�A��y��+,�8�8�:�:�(�D�$����A�4�A��A�A��A�A�B�B�B�����+	C����6�v�i�(�(�(�"�,�X�-=�>�>�M�M�!(�H��$�M�M����<��)��Y�Y�F�F�,4�,<�,B�,B�,D�,D�F�F�F�F�F�"�		$�	$�	$�
�s�#B;�;D,�AD'�'D,c�$�|jdg|�Ri|��S)aSend HEAD request without checking the response.

        Note, that `_check_response` is not called, as it is expected
        that status code other than successfully 2xx will be returned, or
        messages2.Error will be raised by the server.

        �HEAD)r>r�s   r�headzClientNetwork.head�s'��"�t�!�&�:�4�:�:�:�6�:�:�:rc�J�|�|jd|fi|��|���S)z$Send GET request and check response.�GET�r)rr>)rrcrr�s    rr\zClientNetwork.get�s@���#�#��D��u�c�4�4�V�4�4�<�$�Q�Q�	Qrc��|j|jvr�|j|j}	tjjd�|��}n,#tj$r}tj	||���d}~wwxYwt�d|��|j�
|��dStj|���)NrzStoring nonce: %s)�REPLAY_NONCE_HEADERr'r�Header�_fields�decoder�rr�BadNoncerrr��add�MissingNonce)rr+r�
decoded_noncers     r�
_add_noncezClientNetwork._add_nonce�s����#�x�'7�7�7��$�T�%=�>�E�
4� #�
� 2�7� ;� B� B�5� I� I�
�
���,�
4�
4�
4��o�e�U�3�3�3�����
4�����L�L�,�e�4�4�4��L���]�+�+�+�+�+��%�h�/�/�/s�*A
�
A6�A1�1A6r�c�$�|jsqt�d��|�|�|��}n*|�|�|��d���}|�|��|j���S)NzRequesting fresh noncerD)r�rrrArrN�pop)rrcr�r+s    r�
_get_noncezClientNetwork._get_nonce�s����|�	&��L�L�1�2�2�2��$��9�9�S�>�>��� �/�/��	�	�-�0H�0H�W[�/�\�\���O�O�H�%�%�%��|���!�!�!rc��	|j|i|��S#tj$r>}|jdkr-t�d|��|j|i|��cYd}~S�d}~wwxYw)z�POST object wrapped in `.JWS` and check response.

        If the server responded with a badNonce error, the request will
        be retried once.

        �badNoncez Retrying request after error:
%sN)�
_post_oncerr��coderr)rr�r�rs    rr�zClientNetwork.post�s���	�"�4�?�D�3�F�3�3�3���~�	�	�	��z�Z�'�'����@�%�H�H�H�&�t���7��7�7�7�7�7�7�7�7������		���s ��A�2A�A�A�Ac�2�|�dd��}|�||�||��|��}|�dd|i��|jd|fd|i|��}|�||���}|�|��|S)Nr�r'rrr rD)rPrrQr�r>rrN)rrcrrr�r�r r+s        rrTzClientNetwork._post_once�s����
�
�?�D�9�9�
�� � ��d�o�o�c�=�&I�&I�3�O�O�����)�n�l�%C�D�D�D�%�4�%�f�c�G�G��G��G�G���'�'��|�'�L�L������!�!�!��r)rNr�)#r�r�r�r�r�JOSE_CONTENT_TYPErrFr��RS256�DEFAULT_NETWORK_TIMEOUT�JWKrrr��JWASignaturer�r�r�rr�JSONDeSerializablerr�r�r�rrr>rAr\rNrQr�rTr4rrrr�s���������+��/��8��(��
�Z^�*.�*��#0�AX�0�0�D�H�0�x��8U�/V�0��'�0�BF�0� �0�;>�0�]a�0�0�0�0� ����Z�� 7�Z��Z�#�Z�RU�Z�Z�Z�Z�2�6:�8�8�x�'8�8�&.�s�m�8�?G�?P�8�8�8��[�8�tE�C�E�c�E�#�E��E�QY�Qb�E�E�E�E�N;�#�;��;��1B�;�;�;�;�1B�Q�Q�s�Q�#�Q��Q�&�/�Q�Q�Q�Q�
0�8�#4�
0��
0�
0�
0�
0�	"�c�	"�#�	"�#�	"�	"�	"�	"�
�#�
��
��1B�
�
�
�
� (9���c���(?��!$��DG��LT�L]������rr))r�r0rp�email.utilsr�http.client�clientr��loggingr-rz�typingrrrrrr	r
rr�josepyr�rMr��requests.adaptersr
�requests.utilsr�acmerrrrr�	getLoggerr�rrYrrr4rr�<module>rgs'����
�
�
�
�����$�$�$�$�$�$�!�!�!�!�!�!�����	�	�	�	�����������������������������������������������������������������������)�)�)�)�)�)�-�-�-�-�-�-�������������������������������	��	�8�	$�	$����iD�iD�iD�iD�iD�iD�iD�iD�X
F�F�F�F�F�F�F�F�F�Fr