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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cul-spectrum-1.0.0.tar.gz.
File metadata
- Download URL: cul-spectrum-1.0.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
744accf3c437ceaef87bbfe38d1bbb3c7e70e424e7b110262ff66456fc3c9ab3
|
|
| MD5 |
7bd121082871dc84724f18928d6542ed
|
|
| BLAKE2b-256 |
88fc4b2eaa744174a822b16d920f4e2fe7d62f3a719e029077d81069ea24a033
|
File details
Details for the file cul_spectrum-1.0.0-py2.py3-none-any.whl.
File metadata
- Download URL: cul_spectrum-1.0.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0173e5c33550553b505d8fb72cd79f9972ef08c44ad37f5bd6e1e48a7c1463c9
|
|
| MD5 |
e1af50fc395c2e76aa96be09786bad1c
|
|
| BLAKE2b-256 |
a5b84eb75afbd50e8f381ef9d38f42ae40a0ac590556a1fe55af3c666db0c6c1
|