Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use 'response' as variable for object returned from 'http_request'. #98

Merged
merged 1 commit into from
Aug 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions google/resumable_media/requests/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def consume(self, transport):
"""
method, url, payload, headers = self._prepare_request()
# NOTE: We assume "payload is None" but pass it along anyway.
result = _helpers.http_request(
response = _helpers.http_request(
transport,
method,
url,
Expand All @@ -164,12 +164,12 @@ def consume(self, transport):
stream=True,
)

self._process_response(result)
self._process_response(response)

if self._stream is not None:
self._write_to_stream(result)
self._write_to_stream(response)

return result
return response


class ChunkedDownload(_helpers.RequestsMixin, _download.ChunkedDownload):
Expand Down Expand Up @@ -215,11 +215,11 @@ def consume_next_chunk(self, transport):
"""
method, url, payload, headers = self._prepare_request()
# NOTE: We assume "payload is None" but pass it along anyway.
result = _helpers.http_request(
response = _helpers.http_request(
transport, method, url, data=payload, headers=headers,
retry_strategy=self._retry_strategy, stream=True)
self._process_response(result)
return result
self._process_response(response)
return response


def _parse_md5_header(header_value, response):
Expand Down
30 changes: 15 additions & 15 deletions google/resumable_media/requests/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ def transmit(self, transport, data, content_type):
"""
method, url, payload, headers = self._prepare_request(
data, content_type)
result = _helpers.http_request(
response = _helpers.http_request(
transport, method, url, data=payload, headers=headers,
retry_strategy=self._retry_strategy)
self._process_response(result)
return result
self._process_response(response)
return response


class MultipartUpload(_helpers.RequestsMixin, _upload.MultipartUpload):
Expand Down Expand Up @@ -92,11 +92,11 @@ def transmit(self, transport, data, metadata, content_type):
"""
method, url, payload, headers = self._prepare_request(
data, metadata, content_type)
result = _helpers.http_request(
response = _helpers.http_request(
transport, method, url, data=payload, headers=headers,
retry_strategy=self._retry_strategy)
self._process_response(result)
return result
self._process_response(response)
return response


class ResumableUpload(_helpers.RequestsMixin, _upload.ResumableUpload):
Expand Down Expand Up @@ -321,11 +321,11 @@ def initiate(self, transport, stream, metadata, content_type,
method, url, payload, headers = self._prepare_initiate_request(
stream, metadata, content_type,
total_bytes=total_bytes, stream_final=stream_final)
result = _helpers.http_request(
response = _helpers.http_request(
transport, method, url, data=payload, headers=headers,
retry_strategy=self._retry_strategy)
self._process_initiate_response(result)
return result
self._process_initiate_response(response)
return response

def transmit_next_chunk(self, transport):
"""Transmit the next chunk of the resource to be uploaded.
Expand Down Expand Up @@ -390,11 +390,11 @@ def transmit_next_chunk(self, transport):
code is not 200 or 308.
"""
method, url, payload, headers = self._prepare_request()
result = _helpers.http_request(
response = _helpers.http_request(
transport, method, url, data=payload, headers=headers,
retry_strategy=self._retry_strategy)
self._process_response(result, len(payload))
return result
self._process_response(response, len(payload))
return response

def recover(self, transport):
"""Recover from a failure.
Expand All @@ -415,8 +415,8 @@ def recover(self, transport):
"""
method, url, payload, headers = self._prepare_recover_request()
# NOTE: We assume "payload is None" but pass it along anyway.
result = _helpers.http_request(
response = _helpers.http_request(
transport, method, url, data=payload, headers=headers,
retry_strategy=self._retry_strategy)
self._process_recover_response(result)
return result
self._process_recover_response(response)
return response