def _http_request(url, method='GET', headers=None, data=None):
 req = requests.request(method, url, headers=headers, data=data)
 ret = _default_ret()
 ok_status = METHOD_OK_STATUS.get(method, 200)
 if (req.status_code != ok_status):
  ret.update({'comment': req.json().get('error', '')})
  return ret
 ret.update({'result': True, 'out': (req.json() if (method != 'DELETE') else None)})
 return ret

def _http_request ( url , method = 'GET' , headers = None , data = None ) : req = requests . request ( method , url , headers = headers , data = data ) ret = _default_ret ( ) ok_status = METHOD_OK_STATUS . get ( method , 200 ) if ( req . status_code != ok_status ) : ret . update ( { 'comment' : req . json ( ) . get ( 'error' , '' ) } ) return ret ret . update ( { 'result' : True , 'out' : ( req . json ( ) if ( method != 'DELETE' ) else None ) } ) return ret
make the http request and return the body as python object .