3. CLI API

$ cernopendata-client --help
Usage: cernopendata-client [OPTIONS] COMMAND [ARGS]...

Options:
--help  Show this message and exit.

Commands:
download-files      Download data files belonging to a record.
get-file-locations  Get a list of data file locations of a record.
get-metadata        Get metadata content of a record.
list-directory      List contents of a EOSPUBLIC Open Data directory.
verify-files        Verify downloaded data file integrity.
version             Return cernopendata-client version.

3.1. cernopendata-client

Command-line client for interacting with CERN Open Data portal.

cernopendata-client [OPTIONS] COMMAND [ARGS]...

3.1.1. download-files

Download data files belonging to a record.

Select a CERN Open Data bibliographic record by a record ID, a DOI, or a title and download data files belonging to this record.

Examples:

$ cernopendata-client download-files –recid 5500

$ cernopendata-client download-files –recid 5500 –filter-name BuildFile.xml

$ cernopendata-client download-files –recid 5500 –filter-regexp py$

$ cernopendata-client download-files –recid 5500 –filter-range 1-4

$ cernopendata-client download-files –recid 5500 –filter-range 1-2,5-7

$ cernopendata-client download-files –recid 5500 –filter-regexp py –filter-range 1-2

cernopendata-client download-files [OPTIONS]

Options

--recid <recid>

Record ID

--doi <doi>

Digital Object Identifier

--title <title>

Record title

--protocol <protocol>

Protocol to be used in links [http,xrootd]

Options:

http | xrootd

--expand, --no-expand

Expand file indexes? [default=yes]

--server <server>

Which CERN Open Data server to query? [default=http://opendata.cern.ch]

--dry-run

Do not download anything, only print out data file locations to be downloaded

--filter-name <names>

Download files matching exactly the file name

--filter-regexp <regexp>

Download files matching the regular expression

--filter-range <ranges>

Download files from a specified list range (i-j)

--verify

Verify downloaded data file integrity

--retry-limit <retry_limit>

Number of retries when downloading a file [default=10]

--retry-sleep <retry_sleep>

Sleep time in seconds before retrying downloads [default=5]

--download-engine <download_engine>

Download engine to use when downloading files.The available values are ‘requests’, ‘pycurl’, ‘xrootd’.[default=requests (for HTTP protocol), xrootd (for XRootD protocol)]

Options:

requests | pycurl | xrootd

3.1.2. get-file-locations

Get a list of data file locations of a record.

Select a CERN Open Data bibliographic record by a record ID, a DOI, or a title and return the list of data file locations belonging to this record.

Examples:

$ cernopendata-client get-file-locations –recid 5500

$ cernopendata-client get-file-locations –recid 5500 –protocol xrootd

$ cernopendata-client get-file-locations –recid 5500 –verbose

cernopendata-client get-file-locations [OPTIONS]

Options

--recid <recid>

Record ID

--doi <doi>

Digital Object Identifier

--title <title>

Record title

--protocol <protocol>

Protocol to be used in links [http,xrootd]

Options:

http | xrootd

--expand, --no-expand

Expand file indexes? [default=yes]

--server <server>

Which CERN Open Data server to query? [default=http://opendata.cern.ch]

--verbose

Output also the file size (in the second column) and the file checksum (in the third column).

3.1.3. get-metadata

Get metadata content of a record.

Select a CERN Open Data bibliographic record by a record ID, a DOI, or a title and return its metadata in the JSON format.

Examples:

$ cernopendata-client get-metadata –recid 1

$ cernopendata-client get-metadata –recid 1 –output-value title

$ cernopendata-client get-metadata –recid 329 –output-value authors.orcid –filter name=”Rousseau, David”

cernopendata-client get-metadata [OPTIONS]

Options

--recid <recid>

Record ID

--doi <doi>

Digital Object Identifier

--title <title>

Title of the record

--output-value <output_value>

Output value of only desired metadata field [example=title]

--server <server>

Which CERN Open Data server to query? [default=http://opendata.cern.ch]

--filter <filters>

Filter only certain output values matching filtering criteria. [Use –filter some_field_name=some_value]

3.1.4. list-directory

List contents of a EOSPUBLIC Open Data directory.

Returns the list of files and subdirectories of a given EOSPUBLIC directory.

Examples:

$ cernopendata-client list-directory /eos/opendata/cms/validated-runs/Commissioning10

$ cernopendata-client list-directory /eos/opendata/cms/Run2010B/BTau/AOD –recursive

$ cernopendata-client list-directory /eos/opendata/cms/Run2010B –recursive –timeout 10

cernopendata-client list-directory [OPTIONS] PATH

Options

-R, --recursive

Iterate recursively in the given directory path

--timeout <timeout>

Timeout after which to exit running the command [default=60]

Arguments

PATH

Required argument

3.1.5. verify-files

Verify downloaded data file integrity.

Select a CERN Open Data bibliographic record by a record ID and verify integrity of downloaded data files belonging to this record.

Examples:

$ cernopendata-client verify-files –recid 5500

cernopendata-client verify-files [OPTIONS]

Options

--recid <recid>

Record ID

--server <server>

Which CERN Open Data server to query? [default=http://opendata.cern.ch]

3.1.6. version

Return cernopendata-client version.

Examples:

$ cernopendata-client version

cernopendata-client version [OPTIONS]