swarm-keydb

Python SDK Quick Reference

SwarmKeyDb provides two Python SDKs:

Full documentation: docs/python-sdk.md

Install:

pip install swarm-keydb-client

Quick start (async):

import asyncio
from swarm_keydb_client import AsyncSwarmKeyDbClient

async def main():
    client = AsyncSwarmKeyDbClient("ws://localhost:8765/")
    await client.connect()
    await client.set("hello", "world")
    print(await client.get("hello"))  # b"world"
    await client.close()

asyncio.run(main())

Quick start (sync):

from swarm_keydb_client import SwarmKeyDbClient

client = SwarmKeyDbClient("ws://localhost:8765/")
client.set("hello", "world")
print(client.get("hello"))  # b"world"
client.close()

Source: sdk/python/

swarm-keydb (Redis TCP, legacy)

Install:

cd swarm-keydb-py
pip install .

Core API:

Run a complete example:

python examples/user_profile.py