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.2.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.2-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file cul_spectrum-1.0.2.tar.gz.

File metadata

  • Download URL: cul_spectrum-1.0.2.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.2.tar.gz
Algorithm Hash digest
SHA256 58588b113bdcbc31afdf467d9a8dcfa6aeb5d03b42f877774a408da20e51ddad
MD5 1b049c654882e846218cdfb8b36d5347
BLAKE2b-256 b7305e2b05912fb15dceef7eec2c401893388adcf5cd2b2e348d44e0ff84c9ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cul_spectrum-1.0.2-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.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 57c1f71070df0a18abe469f41633b226f6c5a08f4c1b36d12a0095be55e2fc2d
MD5 cda63893af606ccfaceb914ca518cb6a
BLAKE2b-256 c490975f28a48349cff50290a0e772487e24520af457f70c1154fd9781379f6b

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