跳转到主要内容

一个用于与Amazon SQS交互的简单库。

项目描述

https://travis-ci.org/jpetrucciani/qoo.svg?branch=master PyPI version Code style: black Python 3.5+ supported

qoo 是一个用Python编写的非常简单的Amazon SQS客户端。它旨在比boto3更容易使用,并且仅专注于Amazon SQS,忽略AWS生态系统的其余部分。

特性

  • 与SQS队列交互更简单

  • 自动支持AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_DEFAULT_REGION环境变量。

  • 自动有用的消息/作业元数据

用法

安装

pip install qoo

基本用法

import qoo

# list SQS queue names
qoo.list_queues()

# get an existing queue
queue = qoo.get("$QUEUE_NAME")

# or create a queue
queue = qoo.create("$QUEUE_NAME")

# send a job, pass info/keys as kwargs
queue.send(info="foo", user_id="test_user")  # etc.

# get an approximate count of messages in the queue
len(queue)                # approximate total messages
queue.approx_not_visible  # approximate number of message in the visibility timeout

# get a job
job = queue.receive(wait_time=1)
job.elapsed      # time between sending the job and receiving it
job.md5_matches  # boolean property to show that the md5 of the job matches what was sent

# and the data from the job is automatically converted into attrs
job.info         # the string "foo"
job.user_id      # the string "test_user"

# delete the job from the SQS queue
job.delete()

测试

可以使用tox运行测试!

# run tests
tox

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。

源分布

qoo-0.0.4.tar.gz (6.0 kB 查看散列值)

上传时间:

支持者