code: def request(self, path, method, data=None, **kwargs):
          
          if self.api_token:
              self.request_headers['X-Cachet-Token'] = self.api_token
  
          if not path.startswith('http://') and not path.startswith('https://'):
              url = "%s/%s" % (self.api_endpoint, path)
          else:
              url = path
  
          if data is None:
              data = {}
  
          response = self.r_session.request(method, url,
                                            data=json.dumps(data),
                                            headers=self.request_headers,
                                            timeout=self.timeout,
                                            verify=self.verify,
                                            **kwargs)
  
          # If API returns an error, we simply raise and let caller handle it
          response.raise_for_status()
  
          try:
              return response.json()
          except ValueError:
              return {'data': response.text}
docs: Handle requests to API
  
          :param str path: API endpoint's path to request
          :param str method: HTTP method to use
          :param dict data: Data to send (optional)
          :return: Parsed json response as :class:`dict`
  
          Additional named argument may be passed and are directly transmitted
          to :meth:`request` method of :class:`requests.Session` object.