Executable

Working from the command-line

Since version 0.11.12, the Coscine Python SDK provides a command-line executable program written in Python. This makes it easier to interact with Coscine for basic actions such as:

  • Delete: Delete a project, resource or file.

  • Download: Download a project, resource or file.

  • List: List projects, resources or files.

  • Upload: Upload a file to a resource.

without the need to write an extra python script.

Usage

After installing the Coscine Python SDK on your system you can run the Coscine executable with the following command:

py -m coscine

or simply coscine if you have python modules on path (e.g. in a venv).

You need to specify a Coscine API token to use the executable, either via a command-line argument:

coscine -t "My Coscine API Token"

or via an environment variable:

export COSCINE_API_TOKEN="My Coscine API Token" # on Linux
set COSCINE_API_TOKEN=MyCoscineAPIToken # on Windows

Actions

The following snippets assume that the Coscine API Token has been set as an environment variable.

Delete Action

coscine delete -p "My Coscine Project" # deletes the project
coscine delete -p "My Coscine Project" -r "My Coscine Resource" # deletes the resource
coscine delete -p "My Coscine Project" -r "My Coscine Resource" -f "My file path" # deletes the file

Download Action

coscine download -p "My Coscine Project" # downloads the project
coscine download -p "My Coscine Project" -r "My Coscine Resource" # downloads the resource
coscine download -p "My Coscine Project" -r "My Coscine Resource" -f "My file path" # downloads the file

List Action

coscine list # lists all projects
coscine list -p "My Coscine Project" # lists all resources inside the project
coscine list -p "My Coscine Project" -r "My Coscine Resource" # lists all files inside the resource

Upload Action

# Uploads a file to the resource
coscine upload -p "My Coscine Project" -r "My Coscine Resource" -f "Local file path"