Skip to main content

A bundeld set of tools, clients for the lange-suite of tools and more.

Project description

lange-python

Python helpers for Lange services.

Mesh Relay Worker

MeshWorker connects a local HTTP service to the Lange mesh relay and forwards public relay requests to your local target.

pip install lange-python
import asyncio
import time

from lange.mesh.worker import MeshWorker

relay = MeshWorker(
    name="default",
    relay_target="http://localhost:3000",
)

relay.start()

try:
    while relay.remote_relay_address is None and relay.is_alive():
        time.sleep(0.25)
    print(relay.remote_relay_address)
finally:
    asyncio.run(relay.stop())

The worker connects to wss://mesh.lange-labs.com by default and receives a public relay address such as https://default.mesh.lange-labs.com/.

If a mesh deployment requires bearer authentication, pass the token as api_key. Keep API keys in the environment or a local secret store instead of hardcoding them in application code.

import os

from lange.mesh.worker import MeshWorker

relay = MeshWorker(
    name="default",
    relay_target="http://localhost:3000",
    api_key=os.environ["LANGE_LABS_API_KEY"],
)

The relay exposes lifecycle state for integrations:

  • remote_relay_address: public REST relay address returned by the mesh service

Stop the worker from an async context:

await relay.stop()

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

lange_python-0.7.2.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

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

lange_python-0.7.2-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file lange_python-0.7.2.tar.gz.

File metadata

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

File hashes

Hashes for lange_python-0.7.2.tar.gz
Algorithm Hash digest
SHA256 54fe4a39e95c302dc9725be53f78ac7b9963539cb9716feb50b1e6cf3b87fc4b
MD5 ca6accc8f099d67565b9e44d4173f198
BLAKE2b-256 8412efd9c4efceae3a9b26eeba05e4efbb31d14946333961900f787517f1c31a

See more details on using hashes here.

Provenance

The following attestation bundles were made for lange_python-0.7.2.tar.gz:

Publisher: publish.yml on langelabs/lange-python

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

File details

Details for the file lange_python-0.7.2-py3-none-any.whl.

File metadata

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

File hashes

Hashes for lange_python-0.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fc1f4014a91740d30e18878930235fced0265513bd496916ed8a3fecbefefe5a
MD5 ba0651e37af99298a4763498b05db2ae
BLAKE2b-256 4541547a73477ced1ba143255a83e2f64850e20ff610267be70efe1747850b40

See more details on using hashes here.

Provenance

The following attestation bundles were made for lange_python-0.7.2-py3-none-any.whl:

Publisher: publish.yml on langelabs/lange-python

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