Exemplo n.º 1
0
 def delete(self, path, **kwargs):
   url = self.base_url + path
   kwargs = utils.kwargs_converter(kwargs)
   response = self._session.delete(url, params=kwargs)
   response.raise_for_status()
   content = json.loads(response.content)
   content = utils.response_converter(content)
   return content
Exemplo n.º 2
0
 def put(self, path, data=None, **kwargs):
   """Expects data to be a dict."""
   url = self.base_url + path
   kwargs = utils.kwargs_converter(kwargs)
   if data:
     payload = json.dumps(data, default=utils.json_dumps_handler)
   else:
     payload = data
   response = self._session.put(url, data=payload, params=kwargs)
   response.raise_for_status()
   content = json.loads(response.content)
   content = utils.response_converter(content)
   return content