amclient
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]
amclientexposes 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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5ad951ff904c64fd409fa92f94efb40e585825910e4e719a201de12bbd71233
|
|
| MD5 |
0682642a766704a9a4aefe89312288e9
|
|
| BLAKE2b-256 |
57ec2fd38061870c0304926bb3e407a367630c79fa84688198cd799eb408092b
|
Provenance
The following attestation bundles were made for amclient-1.7.0.tar.gz:
Publisher:
release.yml on artefactual-labs/amclient
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
amclient-1.7.0.tar.gz -
Subject digest:
e5ad951ff904c64fd409fa92f94efb40e585825910e4e719a201de12bbd71233 - Sigstore transparency entry: 2347568484
- Sigstore integration time:
-
Permalink:
artefactual-labs/amclient@72c4740adc736ad3c37d0b7c506dc0a1047bb30e -
Branch / Tag:
refs/heads/master - Owner: https://github.com/artefactual-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@72c4740adc736ad3c37d0b7c506dc0a1047bb30e -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9abc7e7bb1cf98e0f2261f4d3685a74d51e06acdb882d4b8b91f9be3641135a
|
|
| MD5 |
32585cd21c1e3a5857b548f6a0eb1969
|
|
| BLAKE2b-256 |
73c30871f212a4478da8f5ee10ca698775514c37721b03489fbe56dc889ddf9f
|
Provenance
The following attestation bundles were made for amclient-1.7.0-py3-none-any.whl:
Publisher:
release.yml on artefactual-labs/amclient
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
amclient-1.7.0-py3-none-any.whl -
Subject digest:
f9abc7e7bb1cf98e0f2261f4d3685a74d51e06acdb882d4b8b91f9be3641135a - Sigstore transparency entry: 2347569636
- Sigstore integration time:
-
Permalink:
artefactual-labs/amclient@72c4740adc736ad3c37d0b7c506dc0a1047bb30e -
Branch / Tag:
refs/heads/master - Owner: https://github.com/artefactual-labs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@72c4740adc736ad3c37d0b7c506dc0a1047bb30e -
Trigger Event:
workflow_dispatch
-
Statement type: