Merge pull request #1 from tsufiev/master

Add HTTPNotModified exception. Use raw_request for getting .tar.gz files...
This commit is contained in:
EkaterinaFedorova 2013-10-17 00:57:14 -07:00
commit 5300203c88
3 changed files with 7 additions and 9 deletions

View File

@ -62,6 +62,10 @@ class HTTPMultipleChoices(HTTPException):
self.details)
class HTTPNotModified(HTTPException):
code = 304
class BadRequest(HTTPException):
"""DEPRECATED!"""
code = 400

View File

@ -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):
"""

View File

@ -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