mdrs-client-python/README.md

160 lines
3.0 KiB
Markdown
Raw Permalink Normal View History

2023-05-01 20:00:32 +09:00
# mdrs-client-python
2023-07-20 11:43:07 +09:00
2023-05-01 20:00:32 +09:00
The mdrs-client-python is python library and a command-line client for up- and downloading files to and from MDRS based repository.
## Installing
2023-07-20 11:43:07 +09:00
```shell
poetry install
2023-05-01 20:00:32 +09:00
```
## Example Usage
### config create
2023-07-20 11:43:07 +09:00
2023-05-01 20:00:32 +09:00
Create remote host configuration
2023-07-20 11:43:07 +09:00
```shell
mdrs config create neurodata https://neurodata.riken.jp/api
2023-05-01 20:00:32 +09:00
```
### login
2023-07-20 11:43:07 +09:00
2023-05-09 19:45:03 +09:00
Login to remote host
2023-07-20 11:43:07 +09:00
```shell
mdrs login neurodata:
2023-05-01 20:00:32 +09:00
Username: (enter your login name)
Password: (enter your password)
mdrs login -u USERNAME -p PASSWORD neurodata:
2023-05-01 20:00:32 +09:00
```
### logout
2023-07-20 11:43:07 +09:00
2023-05-01 20:00:32 +09:00
Logout from remote host
2023-07-20 11:43:07 +09:00
```shell
mdrs logout neurodata:
2023-05-01 20:00:32 +09:00
```
### whoami
2023-07-20 11:43:07 +09:00
2023-05-10 18:17:35 +09:00
Print current user name
2023-07-20 11:43:07 +09:00
```shell
mdrs whoami neurodata:
2023-05-01 20:00:32 +09:00
```
### labs
2023-07-20 11:43:07 +09:00
2023-05-01 20:00:32 +09:00
List all laboratories
2023-07-20 11:43:07 +09:00
```shell
mdrs labs neurodata:
2023-05-01 20:00:32 +09:00
```
### ls
2023-07-20 11:43:07 +09:00
2023-05-01 20:00:32 +09:00
List the folder contents
2023-07-20 11:43:07 +09:00
```shell
mdrs ls neurodata:/NIU/Repository/
2024-09-18 11:24:06 +09:00
mdrs ls -p SHARING_PASSWORD neurodata:/NIU/Repository/PW_Open/
mdrs ls -r neurodata:/NIU/Repository/Dataset1/
mdrs ls -J -r neurodata:/NIU/Repository/Dataset1/
2023-05-01 20:00:32 +09:00
```
### mkdir
2023-07-20 11:43:07 +09:00
2023-05-01 20:00:32 +09:00
Create a new folder
2023-07-20 11:43:07 +09:00
```shell
mdrs mkdir neurodata:/NIU/Repository/TEST
2023-05-01 20:00:32 +09:00
```
### upload
2023-07-20 11:43:07 +09:00
2023-05-09 19:45:03 +09:00
Upload the file or directory
2023-07-20 11:43:07 +09:00
```shell
mdrs upload ./sample.dat neurodata:/NIU/Repository/TEST/
mdrs upload -r ./dataset neurodata:/NIU/Repository/TEST/
2024-09-18 11:24:06 +09:00
mdrs upload -r --skip-if-exists ./dataset neurodata:/NIU/Repository/TEST/
2023-05-01 20:00:32 +09:00
```
### download
2023-07-20 11:43:07 +09:00
2023-05-09 19:45:03 +09:00
Download the file or folder
2023-07-20 11:43:07 +09:00
```shell
mdrs download neurodata:/NIU/Repository/TEST/sample.dat ./
mdrs download -r neurodata:/NIU/Repository/TEST/dataset/ ./
2024-09-18 11:24:06 +09:00
mdrs download -p SHARING_PASSWORD neurodata:/NIU/Repository/PW_Open/Readme.dat ./
mdrs download -r --exclude /NIU/Repository/TEST/dataset/skip neurodata:/NIU/Repository/TEST/dataset/ ./
mdrs download -r --skip-if-exists neurodata:/NIU/Repository/TEST/dataset/ ./
2023-05-01 20:00:32 +09:00
```
2023-05-09 19:45:03 +09:00
### mv
2023-07-20 11:43:07 +09:00
2023-05-09 19:45:03 +09:00
Move or rename the file or folder
2023-07-20 11:43:07 +09:00
```shell
mdrs mv neurodata:/NIU/Repository/TEST/sample.dat neurodata:/NIU/Repository/TEST2/sample2.dat
mdrs mv neurodata:/NIU/Repository/TEST/dataset neurodata:/NIU/Repository/TEST2/
2023-07-20 11:43:07 +09:00
```
### cp
Copy the file and folder
```shell
mdrs cp neurodata:/NIU/Repository/TEST/sample.dat neurodata:/NIU/Repository/TEST2/sample2.dat
mdrs cp -r neurodata:/NIU/Repository/TEST/dataset neurodata:/NIU/Repository/TEST2/
2023-05-01 20:00:32 +09:00
```
2023-05-09 19:45:03 +09:00
### rm
2023-07-20 11:43:07 +09:00
2023-05-09 19:45:03 +09:00
Remove the file or folder
2023-07-20 11:43:07 +09:00
```shell
2024-07-04 12:33:57 +09:00
mdrs rm neurodata:/NIU/Repository/TEST/sample.dat
mdrs rm -r neurodata:/NIU/Repository/TEST/dataset
2023-05-01 20:00:32 +09:00
```
### chacl
2023-07-20 11:43:07 +09:00
Change the folder access level
2023-07-20 11:43:07 +09:00
```shell
mdrs chacl private neurodata:/NIU/Repository/Private
mdrs chacl cbs_open -r neurodata:/NIU/Repository/CBS_Open
2024-09-18 11:24:06 +09:00
mdrs chacl pw_open -r -p SHARING_PASSWORD neurodata:/NIU/Repository/PW_Open
```
2023-05-10 18:17:35 +09:00
### metadata
2023-07-20 11:43:07 +09:00
2023-05-10 18:17:35 +09:00
Get a folder metadata
2023-07-20 11:43:07 +09:00
```shell
mdrs metadata neurodata:/NIU/Repository/TEST/
2024-09-18 11:24:06 +09:00
mdrs metadata -p SHARING_PASSWORD neurodata:/NIU/Repository/PW_Open/
2023-05-10 18:17:35 +09:00
```
2023-05-01 20:00:32 +09:00
### file-metadata
2023-07-20 11:43:07 +09:00
2023-05-01 20:00:32 +09:00
Get the file metadata
2023-07-20 11:43:07 +09:00
```shell
mdrs file-metadata neurodata:/NIU/Repository/TEST/dataset/sample.dat
2024-09-18 11:24:06 +09:00
mdrs file-metadata -p SHARING_PASSWORD neurodata:/NIU/Repository/PW_Open/Readme.txt
2023-05-01 20:00:32 +09:00
```
### help
2023-07-20 11:43:07 +09:00
2023-05-01 20:00:32 +09:00
Show the help message and exit
2023-07-20 11:43:07 +09:00
```shell
mdrs -h
2023-05-01 20:00:32 +09:00
```