Skip to main content

mets-retriever

About

CLI tool for bulk downloading Archivematica METS files.

Unlike Gloria the flat-coated retriever mix, mets-retriever is all about fetching.

Gloria, the flat-coated retriever mix

Usage

After installing with pip (see below), use the retrieve-mets command.

retrieve-mets has two subcommands, fetch-all and fetch-one. Both subcommands have some common arguments:

  • METS files are fetched to a directory specified with the --output-dir argument. If one is not provided, a mets_files directory will be created in the current directory and METS files will be written there.
  • Storage Service credentials must be included using the --ss-url, --ss-user-name, and --ss-api-key arguments for both commands. By default these default to values from the Archivematica Docker development environment.
  • If the --sidecar flag is passed, a sidecar txt file will be written alongside each METS file in the output directory with additional metadata about the AIP not found in the METS file, namely, the storage location UUID and the UUIDs of any AIP replicas.
Usage: retrieve-mets [OPTIONS] COMMAND [ARGS]...

  METS Retriever CLI tool

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  fetch-all  Fetch all METS files not already retrieved.
  fetch-one  Fetch single METS file, even if it's already been retrieved.

fetch-all

To fetch all AIP METS files that have not already been retreived, use the fetch-all subcommand. E.g.:

retrieve-mets fetch-all

Once a METS file is fetched, its UUID is stored in a local SQLite database so that it will not be fetched again on subsequent runs.

This command accepts several optional arguments:

Usage: retrieve-mets fetch-all [OPTIONS]

  Fetch all METS files not already retrieved.

Options:
  --ss-url TEXT         Storage Service host URL  [default:
                        http://127.0.0.1:62081; required]
  --ss-user-name TEXT   Storage Service username  [default: test;
                        required]
  --ss-api-key TEXT     Storage Service API key  [default: test; required]
  --output-dir TEXT     Path to output directory  [default: mets_files;
                        required]
  --sidecar             Write sidecar file for each METS with Storage
                        Location and AIP replica UUIDs
  --with-replicas-only  Only retrieve METS for an AIP if a replica has 
                        also been stored
  --help                Show this message and exit.

fetch-one

To fetch (or re-fetch) a single AIP METS file, use the fetch-one subcommand. E.g.:

retrieve-mets fetch-one 68ee3c66-d90a-4b9a-a33c-2e4e6d339ff7

This command accepts several optional arguments:

Usage: retrieve-mets fetch-one [OPTIONS] AIP_UUID

  Fetch single METS file, even if it's already been retrieved.

Options:
  --ss-url TEXT       Storage Service host URL  [default:
                      http://127.0.0.1:62081; required]
  --ss-user-name TEXT Storage Service username  [default: test; required]
  --ss-api-key TEXT   Storage Service API key  [default: test; required]
  --output-dir TEXT   Path to output directory  [default: mets_files;
                      required]
  --sidecar           Write sidecar file for each METS with Storage 
                      Location and AIP replica UUIDs
  --help              Show this message and exit.

Install

Install mets-retriever package

mets-retriever requires Python 3.6+.

Via PyPI

pip install mets-retriever

Manually

Download this repo:

git clone https://github.com/artefactual-labs/mets-retriever.git

Change into the cloned directory and install:

cd mets-retriever/
pip install .

Development

Installation

For development, it may be useful to install mets-retriever with pip install -e ., which will apply changes made to the source code immediately.

Testing

To run all tests with tox: tox

Or run tests directly with pytest:

pip install -r requirements/test.txt
pytest

Publishing to PyPI

This repository contains a Makefile with commands to aid in building packages and publishing to PyPI.

To check that the package is valid:

make package-check

To upload the package to PyPI (this requires PyPI credentials and being listed as a collaborator on the auditmatica project):

make package-upload

To clean up package distribution files:

make clean

Metadata

Release files for mets-retriever 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mets-retriever 0.2.2
File Size Uploaded Provenance
mets-retriever-0.2.2.tar.gz 9.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mets-retriever 0.2.2
File Interpreter ABI Platform
mets_retriever-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 19.7 kB

Release files / mets-retriever-0.2.2.tar.gz

Download URL mets-retriever-0.2.2.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
47a366d9c03074741358056d001ce7ea36b10fbc6804731003e3503739baef94
BLAKE2b-256 checksum
How to use checksums
304c34cb5dd7edd658accc6c7339514a3f052f8fa1098555af445bc151f950d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.4

Release files / mets_retriever-0.2.2-py3-none-any.whl

Download URL mets_retriever-0.2.2-py3-none-any.whl
Size 10.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e755ad986b8dfc389c5da3fc042e778b3c61ddb996db7a472ff3f41723f7e7db
BLAKE2b-256 checksum
How to use checksums
2386d48742cd5101960d70fdfd7aaf0272a67f984136a01f3024f736a02cebe1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.4

Security for mets-retriever 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page