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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for redis_http_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1bb8d9ccb5c40c7819d17179c5b1a86df9a6b3b13e162bd8d6e70a0c7fa2bc86
MD5 5eeb953fb2c31c667b1bf9baa9b2f2c4
BLAKE2b-256 3e1a14298afd53a593381f1f4bdb18ae24f2ef889811c83a064a075d75d5d20b

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