def wrapper(*args, **kwargs):
     try:
         return f(*args, **kwargs)
     except requests.HTTPError as e:
         raise transport.TransportError(
             'Error in requests\n' + traceback.format_exc(),
             e.response.status_code,
         )
     except requests.RequestException:
         raise transport.TransportError(
             'Error in requests\n' + traceback.format_exc(), 000)
Esempio n. 2
0
 def wrapper(*args, **kwargs):
     try:
         return f(*args, **kwargs)
     except requests.HTTPError as e:
         buf = StringIO.StringIO(e.response.content)
         raise transport.TransportError(
             'Error in requests\n' + traceback.format_exc(),
             e.response.status_code,
             buf,
         )
     except requests.RequestException:
         buf = StringIO.StringIO(traceback.format_exc())
         raise transport.TransportError(
             'Error in requests\n' + traceback.format_exc(),
             000,
             buf,
         )