Skip to main content

Official LoopEngine SDK for sending feedback to the Ingest API

Project description

LoopEngine

Official LoopEngine SDK for sending feedback to the Ingest API. Two-line usage: create a client with your credentials, then call send with your payload.

  • No external dependencies — uses the Python standard library for HTTP and crypto
  • Small surface — one main client (LoopEngine) plus an async wrapper (AsyncLoopEngine)

Install

pip install loopengine

Usage (sync)

from loopengine import LoopEngine

client = LoopEngine(
    project_key="pk_live_...",
    project_secret="psk_live_...",
    project_id="proj_...",
)

result = client.send({"message": "User reported a bug"})
if result.ok:
    print(result.body)  # e.g. {"id": "fb_...", "analysis_status": "pending"}

Usage (async)

import asyncio
from loopengine import AsyncLoopEngine


async def main() -> None:
    client = AsyncLoopEngine(
        project_key="pk_live_...",
        project_secret="psk_live_...",
        project_id="proj_...",
    )
    result = await client.send({"message": "User reported a bug"})
    if result.ok:
        print(result.body)


if __name__ == "__main__":
    asyncio.run(main())

Config

Obtain project_key, project_secret, and project_id from your LoopEngine dashboard. A typical configuration pattern is to read them from environment variables:

import os
from loopengine import LoopEngine

client = LoopEngine(
    project_key=os.environ["LOOPENGINE_PROJECT_KEY"],
    project_secret=os.environ["LOOPENGINE_PROJECT_SECRET"],
    project_id=os.environ["LOOPENGINE_PROJECT_ID"],
)

Payload

The payload object you send must match the fields and constraints you defined when creating your project in the LoopEngine dashboard (required fields, allowed keys, value types, etc.). At a minimum, it should include all the required fields according to your project's schema.

You do not need to pass project_id in the payload; it is automatically injected from the client configuration.

Payloads can be:

  • A mapping/dict (dict[str, object])
  • Any JSON-serializable object (for example a dataclass) that encodes to a JSON object

Geolocation

You can send device location so feedback is associated with coordinates instead of IP-based geo. Pass optional keyword-only arguments geo_lat and geo_lon to send(). When both are provided, the SDK adds geo_lat and geo_lon to the request body; they are included in the HMAC signature. Omit both to use IP-based geolocation. The API expects valid ranges: latitude -90 to 90, longitude -180 to 180.

# Without geo (IP-based location is used)
result = client.send({"message": "Feedback"})

# With device coordinates
result = client.send(
    {"message": "Bug at my location"},
    geo_lat=34.05,
    geo_lon=-118.25,
)

Quick test with uv and clienttest

This repository includes a small clienttest example app you can run to verify your credentials and connectivity.

  1. Install uv (a fast Python package manager/runner):

    pip install uv
    # or: pipx install uv
    
  2. From the loopengine-python directory, run the example:

    # Using environment variables (recommended)
    export LOOPENGINE_PROJECT_KEY="pk_live_..."
    export LOOPENGINE_PROJECT_SECRET="psk_live_..."
    export LOOPENGINE_PROJECT_ID="proj_..."
    
    uv run examples/clienttest.py
    

    uv run creates an isolated environment, resolves dependencies, and executes the script in one step. Because this SDK has no runtime dependencies beyond the standard library, uv mainly provides a fast, reproducible way to run the example without managing a separate virtualenv.

  3. Alternatively, edit placeholders directly in examples/clienttest.py:

    project_key = "<your_project_key_here>"
    project_secret = "<your_project_secret_here>"
    project_id = "<your_project_id_here>"
    

    Then run:

    uv run examples/clienttest.py
    

Development

To run tests locally:

uv run pytest

Requirements

  • Python >= 3.9

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

loopengine-1.1.0.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

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

loopengine-1.1.0-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file loopengine-1.1.0.tar.gz.

File metadata

  • Download URL: loopengine-1.1.0.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for loopengine-1.1.0.tar.gz
Algorithm Hash digest
SHA256 400f0a2262352796bb576300112200b1ca7f3ba60681db03cbb058237f73fe30
MD5 91b4c6204ce2fb34b1df97ddde4b6a2b
BLAKE2b-256 f84454c44433f1f0630cd19ae6dacbe91adeb9eee31d6564e94a8b7395838f7e

See more details on using hashes here.

File details

Details for the file loopengine-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: loopengine-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for loopengine-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee08a52d290200cd58330af686f6c5afddd485a31592806c05fddb09f49ce399
MD5 e08534f3a428f1a01720bf0d8881e27c
BLAKE2b-256 3a88b12b05f768d05f4da79ec1f00b87309f4ca305592d5ea1f4ca9ae20e94cb

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