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
Release history Release notifications | RSS feed
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.2.0.tar.gz
(13.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file caronashow_api-0.2.0.tar.gz.
File metadata
- Download URL: caronashow_api-0.2.0.tar.gz
- Upload date:
- Size: 13.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
606f07410625253e71fd022e12d68149f2f723e179ed5f42ccfbdd3c7254500b
|
|
| MD5 |
d76fca8121df389f022042aa4cfcbf8f
|
|
| BLAKE2b-256 |
04d38eb289f904bf42fd9faaac32c4f42539ae5d6b23a6a5d4bc300d898305e8
|
File details
Details for the file caronashow_api-0.2.0-py3-none-any.whl.
File metadata
- Download URL: caronashow_api-0.2.0-py3-none-any.whl
- Upload date:
- Size: 22.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0f639965fcad645e9b0d8610122890d76928678711edec1527db253ceed988a0
|
|
| MD5 |
b50944b0ae1fccd78110f932b3262554
|
|
| BLAKE2b-256 |
170561d8a33294051395a25e57699f8e0ffe033253076484ea02f58810836172
|