Skip to main content

Python library for uploading files to R2 and registering them with the r2index API

Project description

elaunira-r2index

Python library for uploading files to Cloudflare R2 and registering them with the r2index API.

Installation

pip install elaunira-r2index

Usage

Sync Client

from elaunira.r2index import R2IndexClient, R2Config

client = R2IndexClient(
    api_url="https://r2index.example.com",
    api_token="your-bearer-token",
    r2_config=R2Config(
        access_key_id="your-r2-access-key-id",
        secret_access_key="your-r2-secret-access-key",
        endpoint_url="https://your-account-id.r2.cloudflarestorage.com",
        bucket="your-bucket-name",
    ),
)

# Upload and register a file
record = client.upload_and_register(
    file_path="./myfile.zip",
    category="software",
    entity="myapp",
    remote_path="/releases",
    remote_filename="myapp-1.0.0.zip",
    remote_version="1.0.0",
    tags=["release", "stable"],
)

Async Client

from elaunira.r2index import AsyncR2IndexClient, R2Config

async with AsyncR2IndexClient(
    api_url="https://r2index.example.com",
    api_token="your-bearer-token",
    r2_config=R2Config(
        access_key_id="your-r2-access-key-id",
        secret_access_key="your-r2-secret-access-key",
        endpoint_url="https://your-account-id.r2.cloudflarestorage.com",
        bucket="your-bucket-name",
    ),
) as client:
    record = await client.upload_and_register(
        file_path="./myfile.zip",
        category="software",
        entity="myapp",
        remote_path="/releases",
        remote_filename="myapp-1.0.0.zip",
        remote_version="1.0.0",
        tags=["release", "stable"],
    )

License

MIT

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

elaunira_r2index-0.1.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

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

elaunira_r2index-0.1.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file elaunira_r2index-0.1.0.tar.gz.

File metadata

  • Download URL: elaunira_r2index-0.1.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for elaunira_r2index-0.1.0.tar.gz
Algorithm Hash digest
SHA256 37958389cbf4dab71a0111cb917c160abff7a86be82f46fe17b5f1b34332c379
MD5 ecf2fcef607d83fb74e27ce92638ac29
BLAKE2b-256 be0cc82e42a91df4a0e03f40d70116ed35daabb380040ba56d31723fe0f9ef19

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for elaunira_r2index-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ccf39bd84f9148ad155a966348860b2a30fbf5a1c9e27b563b0089a2890a26a
MD5 00010bf52cd7347420889d6b1a6e6a7c
BLAKE2b-256 7b7e0e6f5099df14938ca5059c50ba24079574a9a354a3007bcb167925273bea

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