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.2.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.2-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: somanylemons-0.1.2.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for somanylemons-0.1.2.tar.gz
Algorithm Hash digest
SHA256 0f13e56a4324e73001feb63acadd2dbbfd5a296cf0f69c6f8fcabf287deb9c5e
MD5 d9ed9f4fa438e428eceb0a5a308d224a
BLAKE2b-256 41e074f396f3d943edc928b8dde3fdf632a19f84727e790c8f199da389c49235

See more details on using hashes here.

Provenance

The following attestation bundles were made for somanylemons-0.1.2.tar.gz:

Publisher: publish.yml on NoMiddleInc/somanylemons-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: somanylemons-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for somanylemons-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 067265848c714a2f93dd3ea8312bea7abc8eab05dea6049d0f0732f07e402a37
MD5 1659d5396fd8339ebbb7832185ebbe24
BLAKE2b-256 d713284b02c46b6c99b2a7ecba99977a165e782b5cdb2af278231998f3a69e47

See more details on using hashes here.

Provenance

The following attestation bundles were made for somanylemons-0.1.2-py3-none-any.whl:

Publisher: publish.yml on NoMiddleInc/somanylemons-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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