Resume upload from session id missing _response_object attrs
Python Version: 3.6.9 SDK Version: 2.11.0
In my attempts, this example to resume an upload fails with
AttributeError Traceback (most recent call last)
<ipython-input-27-ea84704126e5> in <module>
----> 1 uploader.resume()
~/dku-backup-utils/venv/lib/python3.6/site-packages/boxsdk/util/chunked_uploader.py in resume(self)
75 self._inflight_part = None
76 self._part_definitions[part['offset']] = part
---> 77 self._upload()
78 content_sha1 = self._sha1.digest()
79 return self._upload_session.commit(content_sha1=content_sha1, parts=self._part_array)
~/dku-backup-utils/venv/lib/python3.6/site-packages/boxsdk/util/chunked_uploader.py in _upload(self)
98 Utility function for looping through all parts of of the upload session and uploading them.
99 """
--> 100 while len(self._part_array) < self._upload_session.total_parts:
101 # Retrieve the part inflight if it exists, if it does not exist then get the next part from the stream.
102 next_part = self._inflight_part or self._get_next_part()
AttributeError: 'UploadSession' object has no attribute 'total_parts'
I am able to resolve with (file uploaded successfully with matching SHA1):
chunked_uploader = client.upload_session('79C742AFEA58D9F9CD1DD9E3CEA4F5DD').get_chunked_uploader('/path/to/file')
chunked_uploader._upload_session._response_object = chunked_uploader._upload_session.get().response_object
chunked_uploader._upload_session.__dict__.update(chunked_uploader._upload_session._response_object)
I haven't spent enough time studying the object classes etc. to determine how it should be fixed in the project. I figure a regular maintainer will pretty quick.
Hi @rychken, thanks for filing this issue! We will take a look into why resuming the upload is failing with the example code.
I checked and found that self._upload_session is an object of the class UploadSession in objects/upload_session.py.
However, the total_parts property does not exist here.
Before that, I have not declared this property anywhere in the code.
I took a look at the test code and it looks like Mock is adding this value.
Here's my question, has anyone tried split upload using the Python SDK at least once? If so, I'd like to know which version of the SDK allows split uploads, etc.
This issue has been automatically marked as stale because it has not been updated in the last 30 days. It will be closed if no further activity occurs within the next 7 days. Feel free to reach out or mention Box SDK team member for further help and resources if they are needed.
This issue has been automatically closed due to maximum period of being stale. Thank you for your contribution to Box Python SDK and feel free to open another PR/issue at any time.