Skip to main content

A Python OCFL Object validator for content in S3

Project description

OCFL S3 Validator

A Python OCFL Object validator for content in S3.

This validator is a simple wrapper for one small part of the Python OCFL validation utility: ocfl-py. This validator only exposes OCFL Object validation for objects that are stored in an S3 object store. The validator has been tested with: AWS, Wasabi, and IBM's S3 storage appliance, "ECS". This validator takes S3 credentials, an optional "endpoint URL" for non-AWS S3 stores, an S3 bucket name, and the S3 path to the OCFL Object root of an OCFL Object. A validation result object is returned for each OCFL Object validation request.

Usage

  1. Create an ObjectValidator with:
    • S3 bucket name
    • S3 access key ID
    • S3 secret access key
    • S3 endpoint URL (optional: needed for non-AWS S3 providers)
  2. Invoke 'validate()' method with:
    • S3 path to single OCFL object
  3. The 'validate()' method returns a result object with:
    • object_id (str): The ID of the object.
    • ocfl_object_path (str): The path to the OCFL object.
    • validation_status (bool): The status of the validation.
    • error_message (str): The error message, if any.
    • validation_timestamp (datetime): The timestamp of the validation.
  4. The result object has a JSON representation by calling: 'result.as_json()'

Example usage

  • See object_validator.py 'main'
from ocfl_s3_validator import ObjectValidator

def example():
    # Define variables used below: 'bucket_name', 'access_key_id', etc

    validator = ObjectValidator(bucket_name,
        access_key_id,
        secret_access_key,
        endpoint_url)
    result = validator.validate(object_id, object_path)

    print(result.as_json())

Developer quick start

A quick set of commands to run after initial cloning this repository

uv venv --python 3.12.0
source .venv/bin/activate
uv sync
pytest

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

ocfl_s3_validator-0.1.3.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

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

ocfl_s3_validator-0.1.3-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file ocfl_s3_validator-0.1.3.tar.gz.

File metadata

  • Download URL: ocfl_s3_validator-0.1.3.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.11

File hashes

Hashes for ocfl_s3_validator-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8ab6740d62d74855a6dd6c6961012add499dda91247849f6b822c98d519caf8b
MD5 ae35ce440a713fe0015e6b46eea0ad38
BLAKE2b-256 6020dae51392df05c997ab0837482dde56a11aa9dfc67123568b787321efc5c4

See more details on using hashes here.

File details

Details for the file ocfl_s3_validator-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for ocfl_s3_validator-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e1d666908fd459661de4f259a01d42b200907c2583a04b787d7e607379293eb9
MD5 e7ee665a9ad0f4c14788420e143407ed
BLAKE2b-256 dec4ad87583cbadec83040de441b69b870538fb02e89fb1c51ff1a1257ca082c

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