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

Uploaded Python 3

File details

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

File metadata

  • Download URL: lange_python-0.7.3.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.3.tar.gz
Algorithm Hash digest
SHA256 91b8ccd72f3f91bef9b492d9e34b9686791606b3e63716c7d5f88622d9a87812
MD5 313548819bfd59d0ffd6b65dd5223cdb
BLAKE2b-256 b3026648af61ccf34bb780cfbcab045cc1a2c26df39fd2afc8952a08e393081d

See more details on using hashes here.

Provenance

The following attestation bundles were made for lange_python-0.7.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: lange_python-0.7.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c4205a91c36c4adcafc865faabd1ec4bf9926768f89af1b62c7dce11c51a0956
MD5 42336f6a73d91bd57585ef7451bd8ede
BLAKE2b-256 e49ca7c13daff986553ce2c22d1a6d915ee0a318ce23eeda188279abefefe206

See more details on using hashes here.

Provenance

The following attestation bundles were made for lange_python-0.7.3-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