def __init__(self, http_response, response_body=None):
    """Sets the HTTP information in the error.

    Args:
      http_response: The response from the server, contains error information.
      response_body: string (optional) specified if the response has already
                     been read from the http_response object.
    """
    body = response_body or http_response.read()

    self.status = http_response.status
    self.reason = http_response.reason
    self.body = body
    self.headers = atom.http_core.get_headers(http_response)

    self.error_msg = 'Invalid response %s.' % self.status
    try:
      json_from_body = simplejson.loads(body)
      if isinstance(json_from_body, dict):
        self.error_msg = json_from_body.get('error', self.error_msg)
    except (__HOLE__, JSONDecodeError):
      pass
dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/gdata/gauth.py/OAuth2RevokeError.__init__