Revision 6a6175c0 kamaki/clients/__init__.py
b/kamaki/clients/__init__.py | ||
---|---|---|
183 | 183 |
E.g. in most queries the 'X-Auth-Token' header might be the same for |
184 | 184 |
all, but the 'Range' header might be different from request to request. |
185 | 185 |
""" |
186 |
assert isinstance(method, str) or isinstance(method, unicode) |
|
187 |
assert method |
|
188 |
assert isinstance(path, str) or isinstance(path, unicode) |
|
189 |
assert path |
|
186 | 190 |
try: |
187 | 191 |
success = kwargs.pop('success', 200) |
188 |
|
|
189 | 192 |
data = kwargs.pop('data', None) |
190 | 193 |
self.http_client.headers.setdefault('X-Auth-Token', self.token) |
191 | 194 |
|
... | ... | |
236 | 239 |
errstr = ('%s' % type(err))[7:-2] |
237 | 240 |
status = getattr(err, 'status', getattr(err, 'errno', 0)) |
238 | 241 |
raise ClientError('%s\n' % errstr, status=status) |
239 |
|
|
240 |
self.http_client.reset_headers() |
|
241 |
self.http_client.reset_params() |
|
242 |
finally: |
|
243 |
self.http_client.reset_headers()
|
|
244 |
self.http_client.reset_params()
|
|
242 | 245 |
|
243 | 246 |
if success is not None: |
244 | 247 |
# Success can either be an int or a collection |
Also available in: Unified diff