Skip to content

Commit 3f6ed4e

Browse files
authored
fix: do not retry creating a ZIP when response code is 202 (#845)
Fixes #844
1 parent 9492b61 commit 3f6ed4e

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

boxsdk/client/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1461,7 +1461,7 @@ def __create_zip(self, name: str, items: Iterable) -> dict:
14611461
'download_file_name': name,
14621462
'items': zip_file_items
14631463
}
1464-
return self._session.post(url, data=json.dumps(data)).json()
1464+
return self._session.post(url, data=json.dumps(data), skip_retry_codes={202}).json()
14651465

14661466
@api_call
14671467
def download_zip(self, name: str, items: Iterable, writeable_stream: IO) -> dict:

test/unit/client/test_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,9 @@ def test_download_zip(mock_client, mock_box_session, mock_content_response):
15461546
mock_box_session.get.side_effect = [mock_content_response, status_response_mock]
15471547

15481548
status_returned = mock_client.download_zip(name, items, mock_writeable_stream)
1549-
mock_box_session.post.assert_called_once_with(expected_create_url, data=json.dumps(expected_create_body))
1549+
mock_box_session.post.assert_called_once_with(expected_create_url,
1550+
data=json.dumps(expected_create_body),
1551+
skip_retry_codes={202})
15501552
mock_box_session.get.assert_any_call('https://dl.boxcloud.com/2.0/zip_downloads/124hfiowk3fa8kmrwh/content',
15511553
expect_json_response=False, stream=True)
15521554
mock_box_session.get.assert_called_with('https://api.box.com/2.0/zip_downloads/124hfiowk3fa8kmrwh/status')

0 commit comments

Comments
 (0)