Skip to content
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.9.10 (2025-06-26)

- Raise WebStack client errors with a copy of the response content instead of the implicit iterator to allow caller to deserialize the content as many times as needed.

## 0.9.9 (2025-06-19)

### Changes
Expand Down
2 changes: 1 addition & 1 deletion python/mujinwebstackclient/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '0.9.9'
__version__ = '0.9.10'

# Do not forget to update CHANGELOG.md

16 changes: 8 additions & 8 deletions python/mujinwebstackclient/webstackclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ def DownloadFile(self, filename, ifmodifiedsince=None, resolveReferences=False,
if ifmodifiedsince and response.status_code == 304:
return response
if response.status_code != 200:
raise WebstackClientError(response.content.decode('utf-8'), response=response)
raise WebstackClientError(response.content.decode('utf-8'), response=response.content)
return response

def FlushAndDownloadFile(self, filename, timeout=5):
Expand All @@ -803,7 +803,7 @@ def FlushAndDownloadFile(self, filename, timeout=5):
"""
response = self._webclient.Request('GET', '/file/download/', params={'filename': filename}, stream=True, timeout=timeout)
if response.status_code != 200:
raise WebstackClientError(response.content.decode('utf-8'), response=response)
raise WebstackClientError(response.content.decode('utf-8'), response=response.content)
return response

def FlushAndHeadFile(self, filename, timeout=5):
Expand Down Expand Up @@ -852,11 +852,11 @@ def DownloadBlob(self, blobId, timeout=5):
"""
response = self._webclient.Request('GET', u'/api/v2/blob/%s' % blobId, stream=True, timeout=timeout)
if response.status_code == 404:
raise WebstackClientError(_('Blob "%s" does not exist, status code is %d') % (blobId, response.status_code), response=response)
raise WebstackClientError(_('Blob "%s" does not exist, status code is %d') % (blobId, response.status_code), response=response.content)
if response.status_code == 204:
raise WebstackClientError(_('Blob "%s" has no content, status code is %d') % (blobId, response.status_code), response=response)
raise WebstackClientError(_('Blob "%s" has no content, status code is %d') % (blobId, response.status_code), response=response.content)
if response.status_code != 200:
raise WebstackClientError(response.content.decode('utf-8'), response=response)
raise WebstackClientError(response.content.decode('utf-8'), response=response.content)
return response

#
Expand Down Expand Up @@ -899,7 +899,7 @@ def DownloadSignalLog(self, limit=None, cursor=None, includecursor=False, forwar

response = self._webclient.Request('GET', '/log/plcsignal/', params=params, timeout=timeout, stream=True)
if response.status_code != 200:
raise WebstackClientError(_('Failed to retrieve user log, status code is %d') % response.status_code, response=response)
raise WebstackClientError(_('Failed to retrieve user log, status code is %d') % response.status_code, response=response.content)
return response

#
Expand Down Expand Up @@ -1078,7 +1078,7 @@ def Backup(self, saveconfig=True, savemedia=True, backupscenepks=None, savewebap
'backupScenePks': ','.join(backupscenepks) if backupscenepks else None,
}, timeout=timeout)
if response.status_code != 200:
raise WebstackClientError(response.content.decode('utf-8'), response=response)
raise WebstackClientError(response.content.decode('utf-8'), response=response.content)
return response

def Restore(self, file, restoreconfig=True, restoremedia=True, restorewebapps=True, restoreitl=True, restoreeds=True, restoreiodd=True, timeout=600):
Expand Down Expand Up @@ -1151,7 +1151,7 @@ def DownloadDebugResource(self, debugresourcepk, downloadSizeLimit=100*1024*1024
params['endedAt'] = endedAt.isoformat(),
response = self._webclient.Request('GET', '/api/v1/debug/%s/download/' % debugresourcepk, stream=True, timeout=timeout, params=params)
if response.status_code != 200:
raise WebstackClientError(response.content.decode('utf-8'), response=response)
raise WebstackClientError(response.content.decode('utf-8'), response=response.content)
return response

def GetSchema(self, schemaId, timeout=10):
Expand Down