Skip to main content

Python SDK for generating Stowry presigned URLs

Project description

stowrypy

PyPI version Python versions CI codecov License: MIT

A Python SDK for generating Stowry presigned URLs.

Installation

pip install stowrypy

Quick Start

from stowrypy import StowryClient

client = StowryClient(
    endpoint="http://localhost:5708",
    access_key="your-access-key",
    secret_key="your-secret-key",
)

# Generate a presigned URL for downloading a file
get_url = client.presign_get("/files/document.pdf")

# Generate a presigned URL for uploading a file
put_url = client.presign_put("/files/upload.txt")

# Generate a presigned URL for deleting a file
delete_url = client.presign_delete("/files/old.txt")

Usage with HTTP Clients

import requests
from stowrypy import StowryClient

client = StowryClient(
    endpoint="http://localhost:5708",
    access_key="your-access-key",
    secret_key="your-secret-key",
)

# Download a file
get_url = client.presign_get("/files/document.pdf")
response = requests.get(get_url)
content = response.content

# Upload a file
put_url = client.presign_put("/files/upload.txt")
requests.put(put_url, data=b"Hello, World!")

# Delete a file
delete_url = client.presign_delete("/files/old.txt")
requests.delete(delete_url)

API Reference

StowryClient

StowryClient(endpoint: str, access_key: str, secret_key: str)

Creates a new Stowry client.

Parameter Type Description
endpoint str Stowry server URL (e.g., http://localhost:5708)
access_key str Access key ID
secret_key str Secret access key

Methods

presign_get

presign_get(path: str, expires: int = 900) -> str

Generates a presigned URL for GET requests.

Parameter Type Default Description
path str - Object path (must start with /)
expires int 900 URL validity in seconds (1-604800)

presign_put

presign_put(path: str, expires: int = 900) -> str

Generates a presigned URL for PUT requests.

Parameter Type Default Description
path str - Object path (must start with /)
expires int 900 URL validity in seconds (1-604800)

presign_delete

presign_delete(path: str, expires: int = 900) -> str

Generates a presigned URL for DELETE requests.

Parameter Type Default Description
path str - Object path (must start with /)
expires int 900 URL validity in seconds (1-604800)

generate_presigned_url

generate_presigned_url(operation: str, path: str, expires: int = 900) -> str

S3-compatible interface for generating presigned URLs.

Parameter Type Default Description
operation str - get_object, put_object, or delete_object
path str - Object path (must start with /)
expires int 900 URL validity in seconds (1-604800)

URL Expiration

  • Default: 900 seconds (15 minutes)
  • Minimum: 1 second
  • Maximum: 604800 seconds (7 days)

Signing Scheme

This SDK implements Stowry's native signing scheme. URLs are signed using HMAC-SHA256 with the following query parameters:

Parameter Description
X-Stowry-Credential Access key ID
X-Stowry-Date Unix timestamp (seconds)
X-Stowry-Expires Validity in seconds
X-Stowry-Signature Hex-encoded HMAC-SHA256 signature

For AWS Signature V4 compatibility, use boto3. The Stowry server supports both signing schemes.

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

stowrypy-0.1.0.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

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

stowrypy-0.1.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: stowrypy-0.1.0.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stowrypy-0.1.0.tar.gz
Algorithm Hash digest
SHA256 118b5bedcb19a4188ee9ed23ca266c64679ea00cd86ed749c340faf4693ad377
MD5 42dbb5b6848041b725ed5c602e232319
BLAKE2b-256 40dea738f7d3ba39198ec16628d33affc5eea759d73c7211190e5aeb1c7b058b

See more details on using hashes here.

Provenance

The following attestation bundles were made for stowrypy-0.1.0.tar.gz:

Publisher: publish.yml on sagarc03/stowrypy

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

File details

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

File metadata

  • Download URL: stowrypy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for stowrypy-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce74f05c13d7158ec29708d9dcc5cfc892e517f5b33025b1f044e1567b1331d5
MD5 ff2fc5f0d60897548ad480af53888775
BLAKE2b-256 b697d093b7b2e7107722fd86c44708b82f9f6e1d65249d53af6e649c68ff7bbc

See more details on using hashes here.

Provenance

The following attestation bundles were made for stowrypy-0.1.0-py3-none-any.whl:

Publisher: publish.yml on sagarc03/stowrypy

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

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