aiosqs
About package
Python asynchronous and lightweight SQS client. The goal of this library is to provide fast and optimal access to SQS for Python projects, e.g. when you need a high-load queue consumer or high-load queue producer written in Python.
Supports Python versions 3.8, 3.9, 3.10, 3.11, 3.12.
Supported and tested Amazon-like SQS providers: Amazon, VK Cloud.
Why aiosqs?
Main problem of botocore and aiobotocore is huge memory and CPU consumption.
Also aiobotocore itself is a transition of botocore to async interface without any optimizations.
Related issues:
- https://github.com/boto/boto3/issues/1670
- https://github.com/aio-libs/aiobotocore/issues/940
- https://github.com/aio-libs/aiobotocore/issues/970
Installation
pip install aiosqs
Usage
Create a client:
from aiosqs import SQSClient
client = SQSClient(
aws_access_key_id="access_key_id",
aws_secret_access_key="secret_access_key",
region_name="us-west-2",
host="sqs.us-west-2.amazonaws.com",
)
Receive the queue url by queue name:
response = await client.get_queue_url(queue_name=queue_name)
queue_url = response["QueueUrl"]
Send a message to the queue:
response = await client.send_message(
queue_url=queue_url,
message_body=json.dumps({"demo": 1, "key": "value"}),
delay_seconds=0,
)
print(response)
Receive a message from the queue:
response = await client.receive_message(
queue_url=queue_url,
max_number_of_messages=1,
visibility_timeout=30,
)
if response:
print(response)
receipt_handle = response[0]["ReceiptHandle"]
Delete the message from the queue:
await client.delete_message(
queue_url=queue_url,
receipt_handle=receipt_handle,
)
Close the client at the end:
await client.close()
Another option is to use SQSClient as an async context manager. No need to call close manually in this case. Example:
from aiosqs import SQSClient
async with SQSClient(
aws_access_key_id="access_key_id",
aws_secret_access_key="secret_access_key",
region_name="us-west-2",
host="sqs.us-west-2.amazonaws.com",
) as client:
response = await client.get_queue_url(queue_name="dev_orders")
queue_url = response["QueueUrl"]
print(queue_url)
Metadata
Release files for aiosqs 1.0.6
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 |
|---|---|---|---|---|
| aiosqs-1.0.6.tar.gz | 57.5 kB | Without provenance | Details for aiosqs-1.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiosqs-1.0.6-py3-none-any.whl | Python 3 | none | any | Details for aiosqs-1.0.6-py3-none-any.whl |
Total release size: 77.7 kB
Release files / aiosqs-1.0.6.tar.gz
| Download URL | aiosqs-1.0.6.tar.gz |
|---|---|
| Size | 57.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53cd3bb08ad03d610bc93c182e0ac50b982decaa9028bf9a131c479901e39c1d
|
|
BLAKE2b-256 checksum How to use checksums |
b9d2e330e7008a85869aa5ca082076dcf32db9827e2a943855d714ede7d65ea2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Release files / aiosqs-1.0.6-py3-none-any.whl
| Download URL | aiosqs-1.0.6-py3-none-any.whl |
|---|---|
| Size | 20.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95cc950b14d083b492ad35733626aeff39058a1838173cef81eaa927d723da60
|
|
BLAKE2b-256 checksum How to use checksums |
44bee1c3d8c30245e6b357bc3c17e2535cbec07792c4c978d975c466df851547
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.28.1
|
Security for aiosqs 1.0.6
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.