Skip to main content

Python library and CLI tool to download Archivematica METS files

Project description

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 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 and --ss-api-key arguments for both commands. By default these default to values from the Archivematica Docker development environment.
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-api-key TEXT  Storage Service API key  [default: test; required]
  --output-dir TEXT  Path to output directory  [default: mets_files; required]
  --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-api-key TEXT  Storage Service API key  [default: test; required]
  --output-dir TEXT  Path to output directory  [default: mets_files; required]
  --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

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

mets-retriever-0.1.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

mets_retriever-0.1.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file mets-retriever-0.1.0.tar.gz.

File metadata

  • Download URL: mets-retriever-0.1.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.4

File hashes

Hashes for mets-retriever-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4a0fea636a8796195e5fb3df206ea7af257493d9e13028a1fd5faa8fff91d46d
MD5 d1db4b9444ba8ef411e70f938181152f
BLAKE2b-256 fa208d0af514b8bc948aeb385953c0a62e4df02573fd8c62baf8c22ad8530df6

See more details on using hashes here.

File details

Details for the file mets_retriever-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mets_retriever-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.4

File hashes

Hashes for mets_retriever-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c2e6353eaa4bf6c72c2be14dd9ac9d35e218f5ab856a745bc4cd87add919b6c5
MD5 fb92472d4a6427b0d1ab20a49bf0932d
BLAKE2b-256 25f90c32d36b3ad73c139c725e63b158c42a3d0f34cba35931562a84e1150c5b

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