Add support for HEAD and PATCH
Change-Id: Ic874c49b791e9d2cb3d44b15511cbb467a551589
This commit is contained in:
		| @@ -78,6 +78,10 @@ class Manager(object): | ||||
|         resp, body = self.api.get(url) | ||||
|         return self.resource_class(self, body[response_key], loaded=True) | ||||
|  | ||||
|     def _head(self, url): | ||||
|         resp, body = self.api.head(url) | ||||
|         return resp.status == 204 | ||||
|  | ||||
|     def _create(self, url, body, response_key, return_raw=False): | ||||
|         resp, body = self.api.post(url, body=body) | ||||
|         if return_raw: | ||||
| @@ -87,9 +91,10 @@ class Manager(object): | ||||
|     def _delete(self, url): | ||||
|         resp, body = self.api.delete(url) | ||||
|  | ||||
|     def _update(self, url, body, response_key=None, method="PUT"): | ||||
|     def _update(self, url, body=None, response_key=None, method="PUT"): | ||||
|         methods = {"PUT": self.api.put, | ||||
|                    "POST": self.api.post} | ||||
|                    "POST": self.api.post, | ||||
|                    "PATCH": self.api.patch} | ||||
|         try: | ||||
|             resp, body = methods[method](url, body=body) | ||||
|         except KeyError: | ||||
|   | ||||
| @@ -176,11 +176,17 @@ class HTTPClient(httplib2.Http): | ||||
|     def get(self, url, **kwargs): | ||||
|         return self._cs_request(url, 'GET', **kwargs) | ||||
|  | ||||
|     def head(self, url, **kwargs): | ||||
|         return self._cs_request(url, 'HEAD', **kwargs) | ||||
|  | ||||
|     def post(self, url, **kwargs): | ||||
|         return self._cs_request(url, 'POST', **kwargs) | ||||
|  | ||||
|     def put(self, url, **kwargs): | ||||
|         return self._cs_request(url, 'PUT', **kwargs) | ||||
|  | ||||
|     def patch(self, url, **kwargs): | ||||
|         return self._cs_request(url, 'PATCH', **kwargs) | ||||
|  | ||||
|     def delete(self, url, **kwargs): | ||||
|         return self._cs_request(url, 'DELETE', **kwargs) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Dolph Mathews
					Dolph Mathews