123456789101112131415161718192021222324 |
- def recover(self, transport):
- """Recover from a failure.
- This method should be used when a :class:`ResumableUpload` is in an
- :attr:`~ResumableUpload.invalid` state due to a request failure.
- This will verify the progress with the server and make sure the
- current upload is in a valid state before :meth:`transmit_next_chunk`
- can be used again.
- Args:
- transport (~requests.Session): A ``requests`` object which can
- make authenticated requests.
- Returns:
- ~requests.Response: The HTTP response returned by ``transport``.
- """
- method, url, payload, headers = self._prepare_recover_request()
- # NOTE: We assume "payload is None" but pass it along anyway.
- result = _helpers.http_request(
- transport, method, url, data=payload, headers=headers,
- retry_strategy=self._retry_strategy)
- self._process_recover_response(result)
- return result
|