§
    r”j²  ã                   ón   — d Z ddlZddlmZ ddlmZ ddlZddlmZ ddlm	Z	 ddl
mZ ddl
mZ d	„ Zd
„ ZdS )zf
This module provides general http handler functions for processing http responses from BCE services.
é    N)Ústr)Úbytes)Úutils)Úcompat)ÚBceClientError)ÚBceServerErrorc                 ó.  — |                       ¦   «         }|rjt          j        |¦  «        }|j                             t          j        |t          j        ¬¦  «        j        ¦  «         ||j        d<   | j	        |j        d<   |  
                    ¦   «          dS )aË  If the body is not empty, convert it to a python object and set as the value of
    response.body. http_response is always closed if no error occurs.

    :param http_response: the http_response object returned by HTTPConnection.getresponse()
    :type http_response: httplib.HTTPResponse

    :param response: general response object which will be returned to the caller
    :type response: baidubce.BceResponse

    :return: always true
    :rtype bool
    )Úobject_hookÚraw_dataÚstatus_codeT)Úreadr   Úconvert_to_stringÚ__dict__ÚupdateÚjsonÚloadsr   Údict_to_python_objectÚstatusÚclose)Úhttp_responseÚresponseÚbodys      úe/lsinfo/ai/hellotax_ai/data_center/backend/venv/lib/python3.11/site-packages/baidubce/http/handler.pyÚ
parse_jsonr      sŽ   € ð ×ÒÑÔ€DØð @ÝÔ'¨Ñ-Ô-ˆØÔ× Ò ¥¤¨D½eÔ>YÐ!ZÑ!ZÔ!ZÔ!cÑdÔdÐdØ(,ˆÔ˜*Ñ%Ø+8Ô+?ˆÔ˜-Ñ(Ø×ÒÑÔÐØˆ4ó    c                 óÈ  — | j         dz  t          j        j        dz  k    rdS | j         dz  t          j        j        dz  k    rt          d¦  «        ‚d}|                      ¦   «         }|rJt          j        t          j
        |¦  «        ¦  «        }t          |d         |d         |d         ¬¦  «        }|€ t          | j        |j        j        ¬	¦  «        }| j         |_        |‚)
aH  If the body is not empty, convert it to a python object and set as the value of
    response.body. http_response is always closed if no error occurs.

    :param http_response: the http_response object returned by HTTPConnection.getresponse()
    :type http_response: httplib.HTTPResponse

    :param response: general response object which will be returned to the caller
    :type response: baidubce.BceResponse

    :return: false if http status code is 2xx, raise an error otherwise
    :rtype bool

    :raise baidubce.exception.BceClientError: if http status code is NOT 2xx
    éd   Fs#   Can not handle 1xx http status codeNÚmessageÚcodeÚ	requestId)r   Ú
request_id)r!   )r   ÚhttpÚclientÚOKÚCONTINUEr   r   r   r   r   r   r   ÚreasonÚmetadataÚbce_request_idr   )r   r   Úbser   Úds        r   Úparse_errorr+   1   sÙ   € ð Ô˜sÑ"¥d¤k¤n¸Ñ&;Ò;Ð;ØˆuØÔ˜sÑ"¥d¤kÔ&:¸cÑ&AÒAÐAÝÐCÑDÔDÐDØ
€CØ×ÒÑÔ€DØð VÝŒJ•vÔ/°Ñ5Ô5Ñ6Ô6ˆÝ˜Q˜yœ\°°&´	ÀaÈÄnÐUÑUÔUˆØ
€{Ý˜]Ô1¸hÔ>OÔ>^Ð_Ñ_Ô_ˆØ#Ô*€C„OØ
€Ir   )Ú__doc__Úhttp.clientr"   Úbuiltinsr   r   r   Úbaidubcer   r   Úbaidubce.exceptionr   r   r   r+   © r   r   ú<module>r2      sº   ððð ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø €€€Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø -Ð -Ð -Ð -Ð -Ð -Ø -Ð -Ð -Ð -Ð -Ð -ðð ð ð.ð ð ð ð r   