Skip to main content

Walrus Python SDK

The walrus-python SDK provides a Python client for interacting with the Walrus HTTP API. Walrus is a decentralized storage system built on the Sui blockchain, allowing you to store and retrieve blobs efficiently.

PyPI License Tests

Installation

pip install walrus-python

Usage

Initializing the Client

from walrus import WalrusClient

publisher_url = "https://publisher.walrus-testnet.walrus.space"
aggregator_url = "https://aggregator.walrus-testnet.walrus.space"

client = WalrusClient(publisher_base_url=publisher_url, aggregator_base_url=aggregator_url)

Uploading a Blob

Available Parameters

  • encoding_type (Optional[str]): Specifies the encoding used for the blob.

  • epochs (Optional[int]): Number of epochs ahead of the current one to store the blob.

  • deletable (Optional[bool]): Determines whether the blob can be deleted later (True) or is permanent (False).

  • send_object_to (Optional[str]): If provided, sends the Blob object to the specified Sui address.

From Bytes

blob_data = b"Hello Walrus!"
response = client.put_blob(data=blob_data)
print(response)

From a File

file_path = "path/to/your/file.txt"
response = client.put_blob_from_file(file_path)
print(response)

From a Binary Stream

url = "https://example.com/stream"
with requests.get(url, stream=True) as response:
    result = client.put_blob_from_stream(response.raw)
    print(result)

Retrieving a Blob

By Blob ID

blob_id = "your-blob-id"
blob_content = client.get_blob(blob_id)
print(blob_content)

By Object ID

object_id = "your-object-id"
blob_content = client.get_blob_by_object_id(object_id)
print(blob_content)

As a File

blob_id = "your-blob-id"
destination_path = "downloaded_blob.jpg"
client.get_blob_as_file(blob_id, destination_path)
print(f"Blob saved to {destination_path}")

As a Stream

blob_id = "your-blob-id"
stream = client.get_blob_as_stream(blob_id)
with open("streamed_blob.bin", "wb") as f:
    f.write(stream.read())

Retrieving Blob Metadata

blob_id = "your-blob-id"
metadata = client.get_blob_metadata(blob_id)
print(metadata)

Error Handling

WalrusAPIError provides structured error information:

try:
    client.get_blob("non-existent-id")
except WalrusAPIError as e:
    print(e)

Contributing

Contributions are welcome! Please submit a pull request or open an issue for any suggestions, improvements, or bug reports.

Metadata

Release files for walrus-python 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for walrus-python 0.1.0
File Size Uploaded Provenance Actions
walrus_python-0.1.0.tar.gz 8.1 kB With provenance Details for walrus_python-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for walrus-python 0.1.0
File Interpreter ABI Platform Actions
walrus_python-0.1.0-py3-none-any.whl Python 3 none any Details for walrus_python-0.1.0-py3-none-any.whl

Total release size: 14.0 kB

Release files / walrus_python-0.1.0.tar.gz

Download URL walrus_python-0.1.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5ed9b5b88cedf45eac267fe32aab5baefae227b37fd62bac5a5880e1149dd936
BLAKE2b-256 checksum
How to use checksums
f4c7f2bb6ad929a88c2ef784aa2a95b6b2801d4eea75c2e00485044e475a7358
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2025.

Transparency log

Release files / walrus_python-0.1.0-py3-none-any.whl

Download URL walrus_python-0.1.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2db0b04f284a165b361e3343d8d5d4e671010b043e46cc4862ebe766f6d9e807
BLAKE2b-256 checksum
How to use checksums
cd3f95a40cba5292b25ede249016dea851d72561c0dc39d9d733e9ce19d727f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2025.

Transparency log

Security for walrus-python 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for walrus_python-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 8, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page