Skip to main content

Python client for CaronaShow APIs

Project description

caronashow-api

Python client for CaronaShow APIs.

Installation

pip install caronashow-api

Usage

The code below is a minimal version and not comprehensive of all APIs.

To view the API definitions and types, consult the .protobuf files or generated code.

Pooler API client

import asyncio

from caronashow.pooler.v1.pooler_connect import PoolerServiceClient
from caronashow.pooler.v1.pooler_pb2 import (
    MATCHING_ALGORITHM_RANDOM,
    ExecuteMatchingAlgorithmOnDatasetRequest,
)


async def main():
    # Create a client
    client = PoolerServiceClient("http://localhost:8080")

    # Make a request
    request = ExecuteMatchingAlgorithmOnDatasetRequest(
        dataset_id="dataset-123",
        algorithm=MATCHING_ALGORITHM_RANDOM,
    )

    # Call the service
    response = await client.execute_matching_algorithm_on_dataset(request)
    print(response.operation)


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

Pooler API server

from caronashow.pooler.v1.pooler_connect import (
    PoolerService,
    PoolerServiceASGIApplication,
)
from caronashow.pooler.v1.pooler_pb2 import (
    ExecuteMatchingAlgorithmOnDatasetResponse,
    Operation,
    OperationState,
)


class Pooler(PoolerService):
    async def execute_matching_algorithm_on_dataset(self, request, ctx):
        print("Request headers:", ctx.request_headers())
        response = ExecuteMatchingAlgorithmOnDatasetResponse(
            operation=Operation(
                operation_id="op-123",
                dataset_id=request.dataset_id,
                state=OperationState.OPERATION_STATE_SUCCEEDED,
            )
        )
        return response


app = PoolerServiceASGIApplication(Pooler())

Types

from caronashow.types.v1 import user_pb2

# Create user objects
user = user_pb2.User(...)

License

MIT License - see LICENSE file for details.

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

caronashow_api-0.5.2.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

caronashow_api-0.5.2-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file caronashow_api-0.5.2.tar.gz.

File metadata

  • Download URL: caronashow_api-0.5.2.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for caronashow_api-0.5.2.tar.gz
Algorithm Hash digest
SHA256 99b5e49371f17ab84db9c78402d2b22cba13924ec4303f0d510be0175212abfb
MD5 e6edbd780b256a57201049c7a21c3845
BLAKE2b-256 76c10de438a3ea2b3d9bd39b95c87c09befe6cdb4847502810e1d05bb9558717

See more details on using hashes here.

File details

Details for the file caronashow_api-0.5.2-py3-none-any.whl.

File metadata

  • Download URL: caronashow_api-0.5.2-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for caronashow_api-0.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fb122293a8f52a08eedabeb6a6fd120942cb8574dc7ff173e6e43e2c6826a4a4
MD5 63bf1080b66a31b604438e9706b9cc69
BLAKE2b-256 02cf3ed62a4f6f420ec0b00a64cf6cc39218318670622c36e20d0248a82b37be

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