mdrs-client-python/README.md

155 lines
2.7 KiB
Markdown
Raw 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
2023-05-01 20:00:32 +09:00
```
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
2023-05-01 20:00:32 +09:00
```
$ mdrs config create neurodata https://neurodata.riken.jp/api
```
### 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
2023-05-01 20:00:32 +09:00
```
$ mdrs login neurodata:
Username: (enter your login name)
Password: (enter your password)
```
### 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
2023-05-01 20:00:32 +09:00
```
$ mdrs logout neurodata:
```
### 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
2023-05-01 20:00:32 +09:00
```
$ mdrs whoami neurodata:
```
### 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
2023-05-01 20:00:32 +09:00
```
$ mdrs labs neurodata:
```
### 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
2023-05-01 20:00:32 +09:00
```
$ mdrs ls neurodata:/NIU/Repository/
$ mdrs ls -p PW_OPEN_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
2023-05-01 20:00:32 +09:00
```
$ mdrs mkdir neurodata:/NIU/Repository/TEST
```
### 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
2023-05-01 20:00:32 +09:00
```
$ mdrs upload ./sample.dat neurodata:/NIU/Repository/TEST/
$ mdrs upload -r ./dataset neurodata:/NIU/Repository/TEST/
```
### 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
2023-05-01 20:00:32 +09:00
```
$ mdrs download neurodata:/NIU/Repository/TEST/sample.dat ./
$ mdrs download -r neurodata:/NIU/Repository/TEST/dataset/ ./
$ mdrs download -p PW_OPEN_PASSWORD neurodata:/NIU/Repository/PW_Open/Readme.dat ./
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
2023-05-01 20:00:32 +09:00
```
2023-07-20 11:43:07 +09:00
$ 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/
```
### cp
Copy the file and folder
```
$ 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
2023-05-01 20:00:32 +09:00
```
2023-05-09 19:45:03 +09:00
$ mdrs rm neurodata:/NIU/Repository/TEST2/sample2.dat
$ mdrs rm -r neurodata:/NIU/Repository/TEST2/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
```
$ mdrs chacl private neurodata:/NIU/Repository/Private
$ mdrs chacl cbs_open -r neurodata:/NIU/Repository/CBS_Open
$ mdrs chacl pw_open -r -p FOLDER_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
2023-05-10 18:17:35 +09:00
```
$ mdrs metadata neurodata:/NIU/Repository/TEST/
$ mdrs metadata -p PW_OPEN_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
2023-05-01 20:00:32 +09:00
```
$ mdrs file-metadata neurodata:/NIU/Repository/TEST/dataset/sample.dat
$ mdrs file-metadata -p PW_OPEN_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
2023-05-01 20:00:32 +09:00
```
$ mdrs -h
```