diff --git a/metadataclient/common/exceptions.py b/metadataclient/common/exceptions.py index a8e2fef..31fa931 100644 --- a/metadataclient/common/exceptions.py +++ b/metadataclient/common/exceptions.py @@ -62,6 +62,10 @@ class HTTPMultipleChoices(HTTPException): self.details) +class HTTPNotModified(HTTPException): + code = 304 + + class BadRequest(HTTPException): """DEPRECATED!""" code = 400 diff --git a/metadataclient/common/http.py b/metadataclient/common/http.py index b08c36c..242a8f7 100644 --- a/metadataclient/common/http.py +++ b/metadataclient/common/http.py @@ -235,7 +235,7 @@ class HTTPClient(object): elif resp.status in (301, 302, 305): # Redirected. Reissue the request to the new location. return self._http_request(resp['location'], method, **kwargs) - elif resp.status == 300: + elif resp.status in (300, 304): raise exc.from_response(resp) return resp, body_iter @@ -272,12 +272,6 @@ class HTTPClient(object): kwargs['headers']['Transfer-Encoding'] = 'chunked' return self._http_request(url, method, **kwargs) - def archive_request(self, method, url, **kwargs): - kwargs.setdefault('headers', {}) - kwargs['headers'].setdefault('Content-Type', - 'application/x-tar') - return self._http_request(url, method, **kwargs) - class OpenSSLConnectionDelegator(object): """ diff --git a/metadataclient/v1/metadata_client.py b/metadataclient/v1/metadata_client.py index cd509ac..ab29971 100644 --- a/metadataclient/v1/metadata_client.py +++ b/metadataclient/v1/metadata_client.py @@ -39,7 +39,7 @@ class Controller(object): """ url = '/v1/client/ui' - resp, body = self.http_client.archive_request('GET', url) + resp, body = self.http_client.raw_request('GET', url) return body def get_conductor_data(self): @@ -48,5 +48,5 @@ class Controller(object): """ url = '/v1/client/conductor' - resp, body = self.http_client.archive_request('GET', url) + resp, body = self.http_client.raw_request('GET', url) return body \ No newline at end of file