Skip to content

Commit 8f9abaa

Browse files
authored
Merge pull request saleweaver#1079 from Paul-J-Barrett/master
2 parents 923a3a1 + f7f3f34 commit 8f9abaa

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

sp_api/api/reports/reports.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def get_reports(self, **kwargs) -> ApiResponse:
4848
key pageSize: int optional The maximum number of reports to return in a single call.
4949
key createdSince: str or datetime optional The earliest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is 90 days ago. Reports are retained for a maximum of 90 days. string (date-time) -
5050
key createdUntil: str or datetime optional The latest report creation date and time for reports to include in the response, in ISO 8601 date time format. The default is now. string (date-time) -
51-
key nextToken: str optional A string token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getReports operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. string -
51+
key nextToken: str optional A stringget_report_document token returned in the response to your previous request. nextToken is returned when the number of results exceeds the specified pageSize value. To get the next page of results, call the getReports operation and include this token as the only parameter. Specifying nextToken with any other parameters will cause the request to fail. string -
5252
5353
5454
Returns:
@@ -385,8 +385,14 @@ def get_report_document(self, reportDocumentId, download: bool = False, file=Non
385385
if character_code.lower() == 'windows-31j':
386386
character_code = 'cp932'
387387
if 'compressionAlgorithm' in res.payload:
388-
document = zlib.decompress(bytearray(document), 15 + 32)
389-
decoded_document = document.decode(character_code)
388+
try:
389+
document = zlib.decompress(bytearray(document), 15 + 32)
390+
except Exception as e:
391+
document = document
392+
393+
if character_code:
394+
document = document.decode(character_code)
395+
390396
if download:
391397
res.payload.update({
392398
'document': decoded_document,

0 commit comments

Comments
 (0)