parameters: (self)
return_statement: return reason
docstring: Calculate the reason for the error from the response content.
docstring_summary: Calculate the reason for the error from the response content.
docstring_tokens: Calculate the reason for the error from the response content .
function: def _get_reason(self):
      """Calculate the reason for the error from the response content."""
      reason = self.resp.reason
      try:
        data = simplejson.loads(self.content)
        reason = data['error']['message']
      except (ValueError, KeyError):
        pass
      if reason is None:
        reason = ''
      return reason
function_tokens: def _get_reason ( self ) : reason = self . resp . reason try : data = simplejson . loads ( self . content ) reason = data [ 'error' ] [ 'message' ] except ( ValueError , KeyError ) : pass if reason is None : reason = '' return reason