Skip to main content

aiohttp client workers with redis in/out queues

Project description

Installation

$ pip install aiohttp-rq

Environment variables

Variable default
AIOHTTP_RQ_DIR None
AIOHTTP_RQ_REQUEST_QUEUE aiohttp-rq-request
AIOHTTP_RQ_RESPONSE_QUEUE aiohttp-rq-response
AIOHTTP_RQ_EXCEPTION_QUEUE aiohttp-rq-exception

optional

Variable default
AIOHTTP_RQ_DEBUG None
AIOHTTP_RQ_DIR None
REDIS_HOST localhost
REDIS_PORT 6379
REDIS_DB 0

Examples

$ export AIOHTTP_RQ_REQUEST_QUEUE="aiohttp-rq-request"
$ export AIOHTTP_RQ_RESPONSE_QUEUE="aiohttp-rq-response"
$ export AIOHTTP_RQ_EXCEPTION_QUEUE="aiohttp-rq-exception"
$ python3 -m aiohttp_rq 100 # 100 workers

Redis

import redis

REDIS = redis.Redis(host='localhost', port=6379, db=0)

Redis push

value=json.dumps(dict(
    url='https://domain.com',
    method="GET",
    headers=None,
    data=None,
    allow_redirects=True
))
REDIS.rpush('aiohttp-rq-request',*values)

Redis pull

item_list = REDIS.lrange('aiohttp-rq-response',0,-1)
for item in item_list:
    data = json.loads(item.encode('utf-8'))

item_list = REDIS.lrange('aiohttp-rq-exception',0,-1)
for item in item_list:
    data = json.loads(item.encode('utf-8'))

DEBUG

$ export AIOHTTP_RQ_DEBUG=1

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

aiohttp_rq-0.0.3.tar.gz (3.3 kB view details)

Uploaded Source

File details

Details for the file aiohttp_rq-0.0.3.tar.gz.

File metadata

  • Download URL: aiohttp_rq-0.0.3.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for aiohttp_rq-0.0.3.tar.gz
Algorithm Hash digest
SHA256 a918903c3dac6a0feb8c9915a2c6b69723057514e8f3f148833d2f975ed9f41d
MD5 f31ca59e71207816f02cfe453bdb0562
BLAKE2b-256 5195c909fa0fe4e7aa7ca1f4629e8f61670ea2066782671c887f36af6fa358a1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page