Skip to main content

Concordia University Library Spectrum Client

Project description

CUL Spectrum

About

CUL Spectrum implements a Python CLI client for the Concordia University Library Spectrum REST API.

Install

Clone this repo, change into the cloned directory, and install:

cd cul-spectrum
pip install .

Usage

CUL Spectrum currently only implements a client for the set_uuid endpoint.

To add a single AIP:

spectrum set-uuid --uuid=f904e936-a347-4211-82b7-e2a3c4da8cb2 --name=example1

You will be prompted for the Spectrum server URL and authorization token.

Environment variables

To avoid being prompted for the server URL and authorization token on each spectrum invocation, you can set environment variables for these values:

export SPECTRUM_URL=https://example.com/cgi/archivematica
export SPECTRUM_TOKEN=secret123

Input options

You can add a single AIP to Spectrum by specifying the --uuid and --name options:

spectrum set-uuid --uuid=f904e936-a347-4211-82b7-e2a3c4da8cb2 --name=example1

Warning: spectrum does no validation of the UUID and name values or formats.

You can also provide input data for multiple AIPs in CSV format by using the --csv-file option:

spectrum set-uuid --csv-file=../cul_spectrum_test.csv

The CSV file must include a uuid column and either a name column (for a bare AIP name, e.g. "test1"), or a current_path column (for a storage server path, e.g. "3db3/fc8b/0e60/46a2/89fb/2243/1315/b2f9/test1-3bd3fc8b-0e60-46a2-89fb-22431315b2f9.7z").

Output options

CUL Spectrum's default output format is CSV:

$ spectrum set-uuid --uuid=f904e936-a347-4211-82b7-e2a3c4da8cb2 --name=example1
http_status,http_body
200 OK,"{""id"": ""1579""}"

CUL Spectrum also supports JSON output with the --out-format option:

$ spectrum set-uuid --uuid=f904e936-a347-4211-82b7-e2a3c4da8cb2 --name=example1 --out-format=json
{
    "http_status": "200 OK",
    "http_body": "{\"id\": \"1012\"}"
}

To write spectrum's output to a file you can use stdout redirection:

$ spectrum set-uuid --uuid=f904e936-a347-4211-82b7-e2a3c4da8cb2 --name=example1 > results.csv

Development

Testing

To run all tests with tox:

tox

Or run tests directly with pytest:

pip install -r requirements/test.txt
pytest

Credits

This package was created with Cookiecutter and Artefactual's fork of the audreyr/cookiecutter-pypackage project template.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cul-spectrum-1.0.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cul_spectrum-1.0.1-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cul-spectrum-1.0.1.tar.gz.

File metadata

  • Download URL: cul-spectrum-1.0.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for cul-spectrum-1.0.1.tar.gz
Algorithm Hash digest
SHA256 2c3ddf09d6e4ec25c2ac7dd4dd90bbd0bd46ea6e7d174a2210e889d2fbd8025f
MD5 3bc8b5fcf5032541eb2b02774e7f9ea5
BLAKE2b-256 e1705f4c9a80ee558fca213c9144223a005e49dd09ff150f2505eed23de05abd

See more details on using hashes here.

File details

Details for the file cul_spectrum-1.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: cul_spectrum-1.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for cul_spectrum-1.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f6143abfb11e22a3f147b53aa36c19348b11b17d24a93857c64c23e238fa5e5e
MD5 91ef4ef3742d02bbcb4e23536e1155c8
BLAKE2b-256 4fcf1388aa92e5aaf14cfd898f2111d0311fc2c9112d17ee08d9640e9ceda7f7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page