Skip to main content

Python client SDK for Model Drive Protocol.

Project description

modeldriveprotocol-client

Python client SDK for Model Drive Protocol.

Install

pip install modeldriveprotocol-client

Quick start

import asyncio

from modeldriveprotocol import ClientInfo, MdpClient


async def main() -> None:
    client = MdpClient(
        "ws://127.0.0.1:47372",
        ClientInfo(id="python-01", name="Python Client"),
    )

    client.expose_endpoint(
        "/page/search",
        "POST",
        lambda request, _context: {
            "query": request.body.get("query", "") if isinstance(request.body, dict) else "",
        },
        description="Search the current runtime.",
    )

    await client.connect()
    await client.register()


asyncio.run(main())

Included transports

  • WebSocket: ws:// / wss://
  • HTTP loop: http:// / https://

Unlike the browser-focused JavaScript entrypoints, this SDK uses direct transport headers for runtime auth when needed.

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

modeldriveprotocol_client-2.2.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

modeldriveprotocol_client-2.2.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file modeldriveprotocol_client-2.2.0.tar.gz.

File metadata

File hashes

Hashes for modeldriveprotocol_client-2.2.0.tar.gz
Algorithm Hash digest
SHA256 e80d7acc1ce0041577df242ac93fc068658cdb31189a2a3f642a7151205b9a40
MD5 8198521339ad370ce425d6fa7936be14
BLAKE2b-256 07fe6bb1537d87d117ec916388c91aa10c6bb5f6f81ae57ab8ed53f256a35f06

See more details on using hashes here.

File details

Details for the file modeldriveprotocol_client-2.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for modeldriveprotocol_client-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c340ecc20e2a494c6e5a7d3a8a64251a67bb41fc296ce967d9e44eb10c86201
MD5 c7cd5e117636a17a8fce1327b8b70e77
BLAKE2b-256 af97a582e42a4ed549866357cee79e00767082990486772a53e40d95fb685b11

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