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_LOG_CONFIG_FILE None
AIOHTTP_RQ_TTL_DNS_CACHE 10
REDIS_HOST localhost
REDIS_PORT 6379
REDIS_DB 0

Features

  • logging
    • DEBUG, ERROR level messages
    • logging.conf support
  • request: method,url, headers, data,allow_redirects, custom arguments
  • response: url, status, headers,content_path, request_xxx arguments
  • request exception: url, exc_class, exc_message, request_xxx arguments

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"
$ export AIOHTTP_RQ_TTL_DNS_CACHE=3600 # optional
$ python3 -m aiohttp_rq 50 # 50 workers

redis client

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)
data_list = list(map(lambda i:i.encode('utf-8'),item_list))

item_list = REDIS.lrange('aiohttp-rq-exception',0,-1)
data_list = list(map(lambda i:i.encode('utf-8'),item_list))

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

Uploaded Source

File details

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

File metadata

  • Download URL: aiohttp_rq-0.0.8.tar.gz
  • Upload date:
  • Size: 3.6 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.8.tar.gz
Algorithm Hash digest
SHA256 05d6e791f7b068cbfac064df66ffd1b0e86f6c064a48e4c90ad6758413bb36f5
MD5 064af55a2c20b7fc4a21550fc7e28275
BLAKE2b-256 31f04cbf7eac69880d4d4e2514ee3cd66ded0f8e94d38f50922a27244d1df7b3

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