caterva2.remove#
- caterva2.remove(path, urlbase=None, auth_cookie=None)#
Remove a dataset or directory path from a remote repository.
Note that when a directory is removed, only its contents are removed. The directory itself is not removed. This can be handy for future uploads to the same directory. This is preliminary and may change in future versions.
- Parameters:
path¶ (Path) – The path of the dataset or directory.
urlbase¶ (str) – The base of URLs of the subscriber to query. Default is
caterva2.sub_urlbase_default
.auth_cookie¶ (str) – An HTTP cookie for authorizing access. This must be specified unless it was already specified inside a :py_obj:`caterva2.c2context`.
- Returns:
The removed path.
- Return type:
str
Examples
>>> import caterva2 as cat2 >>> import numpy as np >>> # To remove a file you need to be a registered used >>> urlbase = 'https://cat2.cloud/demo' >>> auth_cookie = cat2.get_auth_cookie(urlbase, dict(username='user@example.com', password='foo')) >>> path = f'@personal/dir{np.random.randint(0, 100)}/ds-4d.b2nd' >>> uploaded_path = cat2.upload('root-example/dir2/ds-4d.b2nd', path, urlbase=urlbase, auth_cookie=auth_cookie) >>> removed_path = cat2.remove(path, urlbase, auth_cookie) >>> removed_path == path True