Run jobs in the background of an aiohttp server.
Usage
Define a service
import asyncio
from some_aiohttp_service import BaseService
async def some_long_calculation(a, b):
await asyncio.sleep(5)
return f"Done with {a}/{b}"
class TestService(BaseService):
name = "test"
@staticmethod
async def work(job):
return await some_long_calculation(**job.data)
async def error_handler(self, job, error):
print("Error", error)
async def result_handler(self, job, result):
print(result)
Set up an aiohttp server:
from aiohttp.web import Application, get, run_app
from aiohttp.web_exceptions import HTTPOk, HTTPAccepted
async def health(_):
raise HTTPOk
async def hello(request):
a = request.match_info["a"]
b = request.match_info["b"]
await request.app["test"].commit_work({"a": a, "b": b})
raise HTTPAccepted
app = Application()
app.add_routes([get("/work/{a}/{b}", hello), get("/health", health)])
app.cleanup_ctx.append(TestService(app).init)
run_app(app)
Metadata
Release files for some-aiohttp-service 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| some_aiohttp_service-0.1.7.tar.gz | 5.0 kB | With provenance | Details for some_aiohttp_service-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| some_aiohttp_service-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for some_aiohttp_service-0.1.7-py3-none-any.whl |
Total release size: 11.0 kB
Release files / some_aiohttp_service-0.1.7.tar.gz
| Download URL | some_aiohttp_service-0.1.7.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65744c88fad048c161064ef809e9f0efdcbc077a99534ccc468773fe9a582048
|
|
BLAKE2b-256 checksum How to use checksums |
b12bb690f5ebb3ea3fa1279739feb602a90760eea6b998e1af13703b58bf985f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2024.
Transparency logRelease files / some_aiohttp_service-0.1.7-py3-none-any.whl
| Download URL | some_aiohttp_service-0.1.7-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4261448724f5719ed514b59fb8cf90dfb5392018657a643087d71edb02b8f11c
|
|
BLAKE2b-256 checksum How to use checksums |
9c8fae0ec60d46557036b5037c70f2a38d0fb36dc07aa0427e9d8bc155e494bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2024.
Transparency logSecurity for some-aiohttp-service 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for some_aiohttp_service-0.1.7.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 27, 2024.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.