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.5.tar.gz (3.4 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: aiohttp_rq-0.0.5.tar.gz
  • Upload date:
  • Size: 3.4 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.5.tar.gz
Algorithm Hash digest
SHA256 544b99d6a616166e76c46e486458615606039fa47315bef20ea1fa9e427a1df3
MD5 f4941257aaf9a8629b19bff6b40c6ac6
BLAKE2b-256 6b1b7f6e5ba8d3a36be64df15004a860dd07cb452dc6b3f2cefc35c273cc0e9d

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