Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved exception handling #8

Merged
merged 10 commits into from
Nov 5, 2024
9 changes: 4 additions & 5 deletions cs3client/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ def touch_file(self, auth_token: tuple, resource: Resource) -> None:
self._log.debug(f'msg="Invoked TouchFile" trace="{res.status.trace}"')

def write_file(
self, auth_token: tuple, resource: Resource, content: Union[str, bytes], size: int, lock_md: tuple = None
self, auth_token: tuple, resource: Resource, content: Union[str, bytes], size: int,
app_name: str = None, lock_id: str = None
glpatcern marked this conversation as resolved.
Show resolved Hide resolved
) -> None:
"""
Write a file using the given userid as access token. The entire content is written
Expand All @@ -182,16 +183,14 @@ def write_file(
:param resource: Resource to write content to
:param content: content to write
:param size: size of content (optional)
:param lock_md: tuple (<app_name>, <lock_id>) (optional)
:param app_name: application name (optional)
:param lock_id: lock id (optional)
:return: None (Success)
:raises: FileLockedException (File is locked),
:raises: AuthenticationException (Authentication failed)
:raises: UnknownException (Unknown error)

"""
app_name = lock_id = ''
if lock_md:
app_name, lock_id = lock_md
tstart = time.time()
# prepare endpoint
if size == -1:
Expand Down
Loading