Merge pull request #1 from tsufiev/master
Add HTTPNotModified exception. Use raw_request for getting .tar.gz files...
This commit is contained in:
commit
5300203c88
@ -62,6 +62,10 @@ class HTTPMultipleChoices(HTTPException):
|
|||||||
self.details)
|
self.details)
|
||||||
|
|
||||||
|
|
||||||
|
class HTTPNotModified(HTTPException):
|
||||||
|
code = 304
|
||||||
|
|
||||||
|
|
||||||
class BadRequest(HTTPException):
|
class BadRequest(HTTPException):
|
||||||
"""DEPRECATED!"""
|
"""DEPRECATED!"""
|
||||||
code = 400
|
code = 400
|
||||||
|
@ -235,7 +235,7 @@ class HTTPClient(object):
|
|||||||
elif resp.status in (301, 302, 305):
|
elif resp.status in (301, 302, 305):
|
||||||
# Redirected. Reissue the request to the new location.
|
# Redirected. Reissue the request to the new location.
|
||||||
return self._http_request(resp['location'], method, **kwargs)
|
return self._http_request(resp['location'], method, **kwargs)
|
||||||
elif resp.status == 300:
|
elif resp.status in (300, 304):
|
||||||
raise exc.from_response(resp)
|
raise exc.from_response(resp)
|
||||||
|
|
||||||
return resp, body_iter
|
return resp, body_iter
|
||||||
@ -272,12 +272,6 @@ class HTTPClient(object):
|
|||||||
kwargs['headers']['Transfer-Encoding'] = 'chunked'
|
kwargs['headers']['Transfer-Encoding'] = 'chunked'
|
||||||
return self._http_request(url, method, **kwargs)
|
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):
|
class OpenSSLConnectionDelegator(object):
|
||||||
"""
|
"""
|
||||||
|
@ -39,7 +39,7 @@ class Controller(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
url = '/v1/client/ui'
|
url = '/v1/client/ui'
|
||||||
resp, body = self.http_client.archive_request('GET', url)
|
resp, body = self.http_client.raw_request('GET', url)
|
||||||
return body
|
return body
|
||||||
|
|
||||||
def get_conductor_data(self):
|
def get_conductor_data(self):
|
||||||
@ -48,5 +48,5 @@ class Controller(object):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
url = '/v1/client/conductor'
|
url = '/v1/client/conductor'
|
||||||
resp, body = self.http_client.archive_request('GET', url)
|
resp, body = self.http_client.raw_request('GET', url)
|
||||||
return body
|
return body
|
Loading…
x
Reference in New Issue
Block a user