diff --git a/filecloudapi/fcserver.py b/filecloudapi/fcserver.py index ef53327..91aa095 100644 --- a/filecloudapi/fcserver.py +++ b/filecloudapi/fcserver.py @@ -634,11 +634,12 @@ def upload_bytes( nofileoverwrite: Optional[bool] = False, iflastmodified: Optional[datetime.datetime] = None, progress: Optional[Progress] = None, + ifetag: Optional[str] = None, ) -> ETag: """ Upload bytes 'data' to server at 'serverpath'. """ - return self.upload(BufferedReader(BytesIO(data)), serverpath, datemodified, nofileoverwrite=nofileoverwrite, iflastmodified=iflastmodified, progress=progress) # type: ignore + return self.upload(BufferedReader(BytesIO(data)), serverpath, datemodified, nofileoverwrite=nofileoverwrite, iflastmodified=iflastmodified, progress=progress, ifetag=ifetag) # type: ignore def upload_str( self, @@ -648,6 +649,7 @@ def upload_str( nofileoverwrite: Optional[bool] = False, iflastmodified: Optional[datetime.datetime] = None, progress: Optional[Progress] = None, + ifetag: Optional[str] = None, ) -> ETag: """ Upload str 'data' UTF-8 encoded to server at 'serverpath'. @@ -659,6 +661,7 @@ def upload_str( nofileoverwrite=nofileoverwrite, iflastmodified=iflastmodified, progress=progress, + ifetag=ifetag, ) def upload_file( @@ -670,6 +673,7 @@ def upload_file( iflastmodified: Optional[datetime.datetime] = None, adminproxyuserid: Optional[str] = None, progress: Optional[Progress] = None, + ifetag: Optional[str] = None, ) -> ETag: """ Upload file at 'localpath' to server at 'serverpath'. @@ -683,6 +687,7 @@ def upload_file( iflastmodified, adminproxyuserid=adminproxyuserid, progress=progress, + ifetag=ifetag, ) def _serverdatetime(self, dt: datetime.datetime): @@ -704,6 +709,7 @@ def upload( iflastmodified: Optional[datetime.datetime] = None, adminproxyuserid: Optional[str] = None, progress: Optional[Progress] = None, + ifetag: Optional[str] = None, ) -> ETag: """ Upload seekable stream at uploadf to server at 'serverpath' @@ -838,6 +844,9 @@ def close(self): if iflastmodified is not None: params["iflastmodified"] = str(int(iflastmodified.timestamp())) + if ifetag is not None: + params["ifetag"] = ifetag + params_str = urlencode(params) if params_str.find("%2FSHARED%2F%21"): @@ -887,6 +896,9 @@ def close(self): if iflastmodified is not None: params["iflastmodified"] = str(int(iflastmodified.timestamp())) + if ifetag is not None: + params["ifetag"] = ifetag + if data_size is not None: params["filesize"] = data_size diff --git a/pyproject.toml b/pyproject.toml index c99e908..3b4a2ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "filecloudapi-python" -version = "0.5.2" +version = "0.5.3" description = "A Python library to connect to a Filecloud server" packages = [{ include = "filecloudapi" }]