
    9i	                     F    S r SSKrSSKrSSKJrJr  SSKJr  SSKJ	r	  S r
g)zf
This module provides general http handler functions for processing http responses from BCM services.
    N)compatutils)BceClientError)BceServerErrorc                    U R                   S-  [        R                  R                  S-  :X  a  gU R                   S-  [        R                  R                  S-  :X  a  [        S5      eU R                  5       nU(       d;  [        U R                  UR                  R                  S9nU R                   Ul        Ue[        R                  " [        R                  " U5      5      n[!        U5      nSU;   a  US   b  US   nSnSU;   a  US   b  US   nUR                  R                  nSU;   a  US   b  US   n[        XVUS	9nU R                   Ul        Ue)
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: 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 code)
request_idmessage	Exceptioncoder	   )r   r	   )statushttpclientOKCONTINUEr   readr   reasonmetadatabce_request_idstatus_codejsonloadsr   convert_to_stringstr)http_responseresponsebodybse
error_dictr
   r   r	   s           a/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/baidubce/services/bls/bls_handler.pyparse_errorr!      s@    s"dkknn&;;s"dkk&:&:c&AACDDD]11h>O>O>^>^_'..	F44T:;J*oGJ:i#8#DY'D
6 2 >&!""11Jz!j&>&J-



CC#**CO
I    )__doc__http.clientr   r   baidubcer   r   baidubce.exceptionr   r   r!    r"   r    <module>r(      s       " - -&r"   