Skip to main content

A Redis client over HTTP supporting both sync (requests) and async (aiohttp) modes.

Project description

redis-http-client

A lightweight Redis client over HTTP, supporting both async (aiohttp) and sync (requests) execution modes.

Features

  • Async mode based on aiohttp
  • Sync mode based on requests
  • Dynamic Redis command proxy via __getattr__
  • Pipeline support (redis_pipeline_async / redis_pipeline_sync)
  • Built-in retry and connection-pool handling

Installation

pip install redis-http-client

Quick Start

Async

import asyncio
from redis_http_client import RedisHttpClient


async def main():
    client = RedisHttpClient(
        spider_redis_manager_service_url="http://127.0.0.1:8000",
        mode="async",
    )

    result = await client.get("my_key")
    print(result)

    await client.close()


asyncio.run(main())

Sync

from redis_http_client import RedisHttpClient

client = RedisHttpClient(
    spider_redis_manager_service_url="http://127.0.0.1:8000",
    mode="sync",
)

result = client.get("my_key")
print(result)

# sync mode reuses internal requests session; close when done
import asyncio
asyncio.run(client.close())

Pipeline

commands = [
    {"command": "GET", "args": ["k1"], "kwargs": {}},
    {"command": "GET", "args": ["k2"], "kwargs": {}},
]

# async
# results = await client.redis_pipeline_async(commands)

# sync
# results = client.redis_pipeline_sync(commands)

Build

python -m pip install --upgrade build twine
python -m build

Build outputs are generated in dist/.

Upload To PyPI

1. TestPyPI (recommended first)

twine check dist/*
twine upload -r testpypi dist/*

2. PyPI

twine upload dist/*

You can use API token authentication:

  • username: __token__
  • password: pypi-xxxx...

Versioning

Current version: 0.1.1

When releasing a new version:

  1. Update version in pyproject.toml
  2. Update __version__ in redis_http_client/__init__.py
  3. Rebuild and upload

License

MIT

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

redis_http_client-0.1.4.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

redis_http_client-0.1.4-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file redis_http_client-0.1.4.tar.gz.

File metadata

  • Download URL: redis_http_client-0.1.4.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for redis_http_client-0.1.4.tar.gz
Algorithm Hash digest
SHA256 bf71de012c7942fd0c1eddaf0b0efe807cf3a2fe49dbc7cca354852b7b993d8e
MD5 042b3d92781659e35177e1c81bb7d2a7
BLAKE2b-256 a9891756aa7d0f40d52c92a56e6e128a527ac7a003cbee63a5571ddbd4542d6a

See more details on using hashes here.

File details

Details for the file redis_http_client-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for redis_http_client-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 a320f90998391ae4b4ad6c81bcd829b30f658782892ea31e2181a19718a32c85
MD5 34496499a7946002abdbc680bceceda7
BLAKE2b-256 4caebb21496f9d3420b9c71c332b8f4a6033bd5be6ce5e320d64675b8c69a9a2

See more details on using hashes here.

Supported by

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