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.1.tar.gz (22.5 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.1-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ocfl_s3_validator-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0fabf760dcce388f40f9d5b7d0f57004c7ce0ee56c5507e844551da9dc3dba72
MD5 185a7f9d6a0e5b1f1577e29d7c7cd67b
BLAKE2b-256 100c289eae28b31b7952fcd298929cace8cd702d7b99f8278c15f466f2664d64

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ocfl_s3_validator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dae4523cfe43ad1a7ab02619afb5a8da717c37c9f29d34dcba976ec100c248c9
MD5 7014e5eab54a8e3fc45e173350bb3183
BLAKE2b-256 0ea5e8b7e599f41b64f39e3e775dd76ba574acfa036cb21a71f8995298295922

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