code: def api_request(self, method, path):
          '''
          Query Sensu api for information.
          '''
          if not hasattr(self, 'api_settings'):
              ValueError('api.json settings not found')
  
          if method.lower() == 'get':
              _request = requests.get
          elif method.lower() == 'post':
              _request = requests.post
  
          domain = self.api_settings['host']
          uri = '{}:{}/{}'.format(domain, self.api_settings['port'], path)
          if self.api_settings.get('user') and self.api_settings.get('password'):
              auth = (self.api_settings['user'], self.api_settings['password'])
          else:
              auth = ()
          req = _request(uri, auth=auth)
          return ref api_request(self, method, path):
          '''
          Query Sensu api for information.
          '''
          if not hasattr(self, 'api_settings'):
              ValueError('api.json settings not found')
  
          if method.lower() == 'get':
              _request = requests.get
          elif method.lower() == 'post':
              _request = requests.post
  
          domain = self.api_settings['host']
          uri = '{}:{}/{}'.format(domain, self.api_settings['port'], path)
          if self.api_settings.get('user') and self.api_settings.get('password'):
              auth = (self.api_settings['user'], self.api_settings['password'])
          else:
              auth = ()
          req = _request(uri, auth=auth)
          return req
docs: Query Sensu api for information.