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.5

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.5.tar.gz (12.6 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.5-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for redis_http_client-0.1.5.tar.gz
Algorithm Hash digest
SHA256 8230b6b6767596280bfae40f05c6d3b64fb03ef5fa9075d83e4556fb2c333c9e
MD5 31b184eaceb890af9957a301015d59e6
BLAKE2b-256 bdcca51ad7e83ad86e793ad10c23532eaf8dd51cc8cf199f7be01eef243b1d9a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for redis_http_client-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 3d3ca1f0c6cd521caa583e240be1f1054abeb582a9ad354f8989ca75094b0907
MD5 93135ca1b09377bb5159f124b6713b70
BLAKE2b-256 15d63d050e67710adcf3ae086231cf2dd9a69f8468834eab32182ca9e190a193

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