o
    e                     @   sX   d Z ddl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d Zd	d
 ZdS )zg
This module provides general http handler functions for processing http responses from TSDB services.
    N)utils)BceClientError)BceServerError)Expandoc                 C   s0   |   }|r|jtj|tdj |   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_hookT)read__dict__updatejsonloadsdict_to_python_objectclose)http_responseresponsebody r   SD:\Projects\ConvertPro\env\Lib\site-packages\baidubce/services/tsdb/tsdb_handler.py
parse_json   s
   r   c                 C   s2   i }t |  D ]\}}t|}|||< qt|S )z!

    :param d:
    :return:
    )listitemsstrr   )dattrkvr   r   r   r   ,   s
   
r   )__doc__http.clienthttpr
   Zbaidubcer   Zbaidubce.exceptionr   r   Zbaidubce.utilsr   r   r   r   r   r   r   <module>   s   