Enforce consistent style for push and pull methods

This commit is contained in:
Joffrey F 2015-06-16 15:17:40 -07:00
parent 38a6651ede
commit 26531f1f8d
1 changed files with 13 additions and 10 deletions

View File

@ -912,14 +912,16 @@ class Client(requests.Session):
else: else:
headers['X-Registry-Auth'] = auth.encode_header(auth_config) headers['X-Registry-Auth'] = auth.encode_header(auth_config)
response = self._post(self._url('/images/create'), params=params, response = self._post(
headers=headers, stream=stream, timeout=None) self._url('/images/create'), params=params, headers=headers,
stream=stream, timeout=None
)
self._raise_for_status(response) self._raise_for_status(response)
if stream: if stream:
return self._stream_helper(response) return self._stream_helper(response)
else:
return self._result(response) return self._result(response)
def push(self, repository, tag=None, stream=False, def push(self, repository, tag=None, stream=False,
@ -948,15 +950,16 @@ class Client(requests.Session):
if authcfg: if authcfg:
headers['X-Registry-Auth'] = auth.encode_header(authcfg) headers['X-Registry-Auth'] = auth.encode_header(authcfg)
response = self._post_json(u, None, headers=headers, response = self._post_json(
stream=stream, params=params) u, None, headers=headers, stream=stream, params=params
else: )
response = self._post_json(u, None, stream=stream, params=params)
self._raise_for_status(response) self._raise_for_status(response)
return stream and self._stream_helper(response) \ if stream:
or self._result(response) return self._stream_helper(response)
return self._result(response)
@check_resource @check_resource
def remove_container(self, container, v=False, link=False, force=False): def remove_container(self, container, v=False, link=False, force=False):