Python SDK for generating Stowry presigned URLs
Project description
stowrypy
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
Release history Release notifications | RSS feed
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 stowrypy-0.2.0.tar.gz.
File metadata
- Download URL: stowrypy-0.2.0.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50e94cc98793fa06fa4184c7d355ceecc2e08dd661f2af55c8746b6318440ad0
|
|
| MD5 |
277c2c7baa2ec721febf3bc8e010dd2a
|
|
| BLAKE2b-256 |
09afe5741698aa9cde0ea243835bc9d3f9caf241ad407feadd61b8e5a6100e4b
|
Provenance
The following attestation bundles were made for stowrypy-0.2.0.tar.gz:
Publisher:
publish.yml on sagarc03/stowrypy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stowrypy-0.2.0.tar.gz -
Subject digest:
50e94cc98793fa06fa4184c7d355ceecc2e08dd661f2af55c8746b6318440ad0 - Sigstore transparency entry: 939699623
- Sigstore integration time:
-
Permalink:
sagarc03/stowrypy@8dd8ebabff726bca053a45c5748acece05c361ad -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/sagarc03
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8dd8ebabff726bca053a45c5748acece05c361ad -
Trigger Event:
release
-
Statement type:
File details
Details for the file stowrypy-0.2.0-py3-none-any.whl.
File metadata
- Download URL: stowrypy-0.2.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
429b35836217db72bd29823ad36423f0f9de86d3a887a8837f68937afd172f45
|
|
| MD5 |
b4e0add66b1ba56d190fb00798ef64ff
|
|
| BLAKE2b-256 |
13393ecdbe85af9bf26a47a3b4c5139454278655759f08303b765567d95024da
|
Provenance
The following attestation bundles were made for stowrypy-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on sagarc03/stowrypy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stowrypy-0.2.0-py3-none-any.whl -
Subject digest:
429b35836217db72bd29823ad36423f0f9de86d3a887a8837f68937afd172f45 - Sigstore transparency entry: 939699626
- Sigstore integration time:
-
Permalink:
sagarc03/stowrypy@8dd8ebabff726bca053a45c5748acece05c361ad -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/sagarc03
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8dd8ebabff726bca053a45c5748acece05c361ad -
Trigger Event:
release
-
Statement type: