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.1.tar.gz (19.0 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.1-py3-none-any.whl (30.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lange_python-0.7.1.tar.gz
  • Upload date:
  • Size: 19.0 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.1.tar.gz
Algorithm Hash digest
SHA256 1e4d691fb7d61ac6f51bde0c27fb9e75d3e13e0731ce415b6a8776d89333b76d
MD5 096ad319f636ef149c079a1968309437
BLAKE2b-256 66d8fbf896cf998ff0f53b8aa44f721552eb3046b84e36f194130efaa1789de6

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: lange_python-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 30.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 37ee508d5dc800e461ee38cd424850ae85420eadc14d53e603abccdf5ebf6d98
MD5 98141f57a764487d5804ffecc49e0c32
BLAKE2b-256 de8236af474578f7475638fdf454b448a069b892ca1883260ad174de3ceeb411

See more details on using hashes here.

Provenance

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