Asynchronous client library for interacting with MOTHR
Project description
aiomothr
Installation
pip install aiomothr
Usage
Basic example submitting a job request
from aiomothr import AsyncJobRequest
request = AsyncJobRequest(service="echo")
request.add_parameter(value="Hello MOTHR!")
result = await request.run_job()
print(result)
Submitting a job request Using AsyncMothrClient
. This allows you to reuse the
client connection when making multiple requests.
from mothrpy import AsyncJobRequest, AsyncMothrClient
client = AsyncMothrClient()
# Send one request
request = AsyncJobRequest(client=client, service="echo")
request.add_parameter(value="Hello MOTHR!")
result = await request.run_job()
print(result)
# Reuse the client in another request
request = AsyncJobRequest(client=client, service="echo")
request.add_parameter(value="Hello again MOTHR!")
result = await request.run_job()
print(result)
Submit concurrent job requests
import asyncio
from mothrpy import AsyncJobRequest, AsyncMothrClient
client = AsyncMothrClient()
request_a = AsyncJobRequest(client=client, service="echo")
request_a.add_parameter(value="Hello MOTHR!")
request_b = AsyncJobRequest(client=client, service="echo")
request_b.add_parameter(value="Hello again MOTHR!")
# Execute both requests concurrently
tasks = [request_a.run_job(), request_b.run_job()]
results = await asyncio.gather(*tasks)
for result in results:
print(result)
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
aiomothr-0.3.0.tar.gz
(9.5 kB
view details)
Built Distribution
aiomothr-0.3.0-py3-none-any.whl
(10.2 kB
view details)
File details
Details for the file aiomothr-0.3.0.tar.gz
.
File metadata
- Download URL: aiomothr-0.3.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1454ec1f54c1caafaa09babf332a0f93cde77cc006aa70ec1a1bc62b7ad0d5a3 |
|
MD5 | 44dce7390a6d9822b7950fba90df7d51 |
|
BLAKE2b-256 | 56eb384f8eacef7dcfccaec889e69e8138946d8524a6e320b86aa7bb602d64bf |
File details
Details for the file aiomothr-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: aiomothr-0.3.0-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 395279c9f7a579b65ae26ab2d2a0392d4e655ec205578ae4d6ae2a61690951fd |
|
MD5 | 0ac43139e172eaa1841fa22569d85119 |
|
BLAKE2b-256 | 4fab63f42fad7a8886ee8b3a20a31eface359d23c017278b53a82a4ba441516e |