Skip to main content

amclient

GitHub CI codecov

AMClient is an Archivematica API client library and Python package for making it easier to talk to Archivematica from your Python scripts. AMClient also acts as a command line application which can easily be combined with shell-scripts to perform the same functions as a Python script might.

AMClient brings together the majority of the functionality of the two primary Archivematica components:

Basic usage:

amclient.py <subcommand> [optional arguments] <positional argument(s)>

E.g.:

amclient.py close-completed-transfers \
    --am-user-name test 234deffdf89d887a7023546e6bc0031167cedf6

To see a list of all commands and how they are used, then run amclient.py without any arguments.

To understand how to use an individual subcommand, simply run: amclient.py <subcommand>, the output will describe the input parameters for that command:

E.g.:

usage: amclient extract-file [-h] [--ss-user-name USERNAME] [--ss-url URL]
                              [--directory DIR]
                              [--saveas-filename SAVEASFILENAME]
                              ss_api_key package_uuid relative_path

Calling the module from Python:

E.g.:

from amclient import AMClient

am = AMClient()
am.ss_url = "http://127.0.0.1:62081"
am.ss_user_name = "test"
am.ss_api_key = "test"
am.list_storage_locations()
# ...json is output here...

Idempotent transfer submission

Archivematica can safely replay transfer submissions when the client supplies an idempotency key. The caller must choose a stable key and reuse it with the same transfer parameters for every retry:

from amclient import AMClient

am = AMClient(
    am_url="http://127.0.0.1:62080",
    am_user_name="test",
    am_api_key="test",
    transfer_directory="/path/to/transfer",
    transfer_name="example-transfer",
    transfer_type="standard",
    processing_config="automated",
    idempotency_key="workflow-123-transfer",
)
result = am.create_package()

The option is also available to the command-line client:

amclient create-package API_KEY /path/to/transfer \
    --idempotency-key workflow-123-transfer

Archivematica accepts keys containing 1-255 visible ASCII characters without whitespace. It returns HTTP 409 while an identical request is still in progress and HTTP 422 when the key is reused with different transfer parameters. Python callers can set enhanced_errors=True to inspect these responses through the returned error object's status_code and message attributes.

Python API status

[!NOTE] amclient exposes a first-generation Python API that grew alongside the Archivematica and Storage Service APIs. Its dynamic attribute-based configuration, largely untyped return values, and legacy integer-based error handling should not be considered the intended design for a future major version.

We welcome discussion and contributions toward a typed v2 client with explicit operation inputs, consistent response and exception models, and a clearer separation between library and CLI concerns. The Archivematica API specification may also enable parts of the client's development to be automated while keeping its implementation aligned with the API contract.

CONTRIBUTING

For information about contributing to this project please see the AMClient CONTRIBUTING.md

Download files

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

Source Distribution

amclient-1.7.0.tar.gz (71.7 kB view details)

Uploaded Source

Built Distribution

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

amclient-1.7.0-py3-none-any.whl (43.2 kB view details)

Uploaded Python 3

File details

Details for the file amclient-1.7.0.tar.gz.

File metadata

  • Download URL: amclient-1.7.0.tar.gz
  • Upload date:
  • Size: 71.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for amclient-1.7.0.tar.gz
Algorithm Hash digest
SHA256 e5ad951ff904c64fd409fa92f94efb40e585825910e4e719a201de12bbd71233
MD5 0682642a766704a9a4aefe89312288e9
BLAKE2b-256 57ec2fd38061870c0304926bb3e407a367630c79fa84688198cd799eb408092b

See more details on using hashes here.

Provenance

The following attestation bundles were made for amclient-1.7.0.tar.gz:

Publisher: release.yml on artefactual-labs/amclient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file amclient-1.7.0-py3-none-any.whl.

File metadata

  • Download URL: amclient-1.7.0-py3-none-any.whl
  • Upload date:
  • Size: 43.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for amclient-1.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9abc7e7bb1cf98e0f2261f4d3685a74d51e06acdb882d4b8b91f9be3641135a
MD5 32585cd21c1e3a5857b548f6a0eb1969
BLAKE2b-256 73c30871f212a4478da8f5ee10ca698775514c37721b03489fbe56dc889ddf9f

See more details on using hashes here.

Provenance

The following attestation bundles were made for amclient-1.7.0-py3-none-any.whl:

Publisher: release.yml on artefactual-labs/amclient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 files

1.6.0

2 files

1.5.0

2 files

1.4.0

2 files

1.3.1

2 files

1.3.0

2 files

1.2.3

2 files

1.2.2

2 files

1.2.1

2 files

1.2.0

2 files

1.1.1

2 files

1.0.0

2 files

Supported by

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