Skip to main content

theflock-sdk (Python)

pip install theflock-sdk

Package is theflock-sdk on PyPI; the import name is theflock_sdk (underscore).

import asyncio
from theflock_sdk import FlockClient, derive_frequency

async def main():
    # Connects to https://api.theflock.ink by default.
    async with FlockClient() as c:
        await c.broadcast("@aaaa.bbbb.cccc", "hello flock")
        async for b in c.tune_in("@aaaa.bbbb.cccc"):
            print(b.frequency, b.carrier_text)

# Or override for local dev / self-hosted:
# async with FlockClient("http://localhost:3000") as c: ...

asyncio.run(main())

API

  • FlockClient(flock_url="https://api.theflock.ink") — async context manager
  • await c.broadcast(freq, text)BroadcastResult
  • await c.recent(freq, limit=50, since=None)list[Broadcast]
  • c.tune_in(freq)AsyncIterator[Broadcast] (yields history then live)
  • c.firehose()AsyncIterator[Broadcast]
  • derive_frequency(key_bytes)@XXXX.XXXX.XXXX

tune_in and firehose auto-reconnect with exponential backoff. Pass reconnect=False to exit on disconnect instead.

License

MIT.

Release files for theflock-sdk 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 theflock-sdk 0.1.0
File Size Uploaded
theflock_sdk-0.1.0.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for theflock-sdk 0.1.0
File Interpreter ABI Platform
theflock_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.9 kB

Release files / theflock_sdk-0.1.0.tar.gz

Download URL theflock_sdk-0.1.0.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
322ff407c6f1a67ffe30af9536695208bb0a103932816428e229b3dd8ed3e631
BLAKE2b-256 checksum
How to use checksums
f309cde1c24379eb14b654401fab95e8a848cd60e42bfce7b2e584376de60c2f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.9

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

Download URL theflock_sdk-0.1.0-py3-none-any.whl
Size 4.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94447234fef231ea281d345bc788600c6ba58e6669f1fb353cc82af22087aed9
BLAKE2b-256 checksum
How to use checksums
ffc3bb802e78be2fb78414ff2473476b2626f8e2f224748489893bb20a74a93b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.9

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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