Skip to main content

Python SDK for the SoManyLemons Public API — branded video reels, LinkedIn content, image quotes.

Project description

SoManyLemons Python SDK

Typed Python client for the SoManyLemons Public API. Submit recordings, render branded reels and image quotes, manage brands and drafts — from any Python app, no MCP required.

Install

pip install somanylemons

Quickstart

from somanylemons import SMLClient

client = SMLClient(api_key="sml_your_key_here")

# List recent recordings (compact metadata — no URLs)
for job in client.jobs.list(limit=5):
    print(f"{job.id} · {job.title} · {job.clip_count} clips")

# Submit a video and wait for rendered clips
job = client.reels.create_and_wait(
    url="https://example.com/recording.mp4",
    brand_profile_id=1,
    caption_style="LEMON",
    timeout=600,
)
for clip in job.clips:
    print(clip.url)

# Render an image quote with a pinned template (deterministic output)
result = client.image_quotes.create(
    quote_text="Labor productivity is the story of the next five years.",
    brand_profile_id=1,
    template_id=42,
)
print(result.image_url)

Configuration

Arg / env var Default Notes
api_key / SML_API_KEY — (required) Your sml_xxx key
base_url / SML_API_URL https://api.somanylemons.com Override for QAS / local
timeout 30.0 Seconds per request
max_retries 3 Retries on 5xx and 429
client = SMLClient(api_key="sml_xxx", base_url="https://api.qas.somanylemons.com")

Resources

Attribute Endpoints
client.jobs List, get, poll recordings
client.reels Create reels (sync or blocking)
client.transcribe Transcribe URL or file
client.image_quotes Render branded quote images
client.brands Manage brand profiles
client.drafts Content queue
client.content Generate / score / rewrite posts, extract quotes, usage

Error handling

from somanylemons import QuotaError, RateLimitError, JobFailedError, SMLClient

client = SMLClient(api_key="sml_xxx")

try:
    job = client.reels.create_and_wait(url="...")
except QuotaError as exc:
    print(f"Over quota: {exc.renders_used}/{exc.render_limit}")
except RateLimitError as exc:
    print(f"Rate limited, retry after {exc.retry_after}s")
except JobFailedError as exc:
    print(f"Render failed: {exc.message}")

Async

The async client (AsyncSMLClient) lands in 0.2.0. For now, wrap sync calls in asyncio.to_thread.

Security

The SDK is built so that common mistakes cannot leak your API key:

  • Keys never appear in repr or logs. The client masks the key in its __repr__ and stores it in a _SecretStr wrapper. Explicit access requires .get().
  • HTTPS enforced by default. Passing an http:// URL raises SMLError unless you opt in with allow_insecure_http=True (e.g. for local dev against localhost:8000).
  • Foreign hosts rejected by default. Your base_url must be a SoManyLemons domain. If you need to point at a different host (a staging environment, a proxy), pass allow_foreign_host=True so the decision is explicit.
  • Sensible retries only. 5xx and 429 responses retry with exponential backoff; 4xx errors (auth, permissions, validation) fail fast without retry so bad keys don't hammer the server.

If you're integrating the SDK in a shared / multi-tenant app, create one SMLClient per tenant so a per-request key override is never necessary.

Contributing

The project follows PEP 517/621 so any Python toolchain works (pip, uv, poetry, rye, pixi). No lockfile is published — consumers use their own.

# Clone and install in editable mode with dev dependencies
git clone https://github.com/NoMiddleInc/somanylemons-sdk.git
cd somanylemons-sdk
pip install -e ".[dev]"

# Run the test suite (pytest + respx for HTTP mocking)
pytest

# Lint and type-check
ruff check src tests
mypy src

Publish flow (maintainers):

pip install build twine
python -m build
twine upload dist/*

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

somanylemons-0.1.1.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

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

somanylemons-0.1.1-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file somanylemons-0.1.1.tar.gz.

File metadata

  • Download URL: somanylemons-0.1.1.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for somanylemons-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d9979dfe59e7126cdba58d5c8becddce72ce9eb5d54fac7c4f5e21b5caa59a8a
MD5 df00469f6585d0b06f26d84ee634529a
BLAKE2b-256 3c37fc268b4cd1cee37c6819f91ccfc40e02b9e559fa2ea3e90ec530bb66d927

See more details on using hashes here.

File details

Details for the file somanylemons-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: somanylemons-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for somanylemons-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 acf223d9ebcb150894fcfa8f90997c67756201f0f776190688765727d189ad92
MD5 797efe863468b603c04a11d83d3c4fe6
BLAKE2b-256 ff604978b450436892efa07ee8e43a1e75028ede4ed5778d48db0157f7e8cdfd

See more details on using hashes here.

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