def urlfetch(request):
 http_client = tornado.httpclient.HTTPClient()
 try:
  response = http_client.fetch(request)
  result = {JSONTags.SUCCESS: True, JSONTags.BODY: response.body}
 except tornado.httpclient.HTTPError as http_error:
  logging.error("Error while trying to fetch '{0}': {1}".format(request.url, str(http_error)))
  result = {JSONTags.SUCCESS: False, JSONTags.REASON: hermes_constants.HTTPError}
 except Exception as exception:
  logging.exception("Exception while trying to fetch '{0}': {1}".format(request.url, str(exception)))
  result = {JSONTags.SUCCESS: False, JSONTags.REASON: str(exception)}
 http_client.close()
 return result

def urlfetch ( request ) : http_client = tornado . httpclient . HTTPClient ( ) try : response = http_client . fetch ( request ) result = { JSONTags . SUCCESS : True , JSONTags . BODY : response . body } except tornado . httpclient . HTTPError as http_error : logging . error ( "Error while trying to fetch '{0}': {1}" . format ( request . url , str ( http_error ) ) ) result = { JSONTags . SUCCESS : False , JSONTags . REASON : hermes_constants . HTTPError } except Exception as exception : logging . exception ( "Exception while trying to fetch '{0}': {1}" . format ( request . url , str ( exception ) ) ) result = { JSONTags . SUCCESS : False , JSONTags . REASON : str ( exception ) } http_client . close ( ) return result
uses a tornado http client to perform http requests .