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:
- Update
versioninpyproject.toml - Update
__version__inredis_http_client/__init__.py - Rebuild and upload
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redis_http_client-0.1.1.tar.gz.
File metadata
- Download URL: redis_http_client-0.1.1.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd57bb8e0e357dcd51431386b50b1c12d9108835e740be3a9ce8883f3da190d5
|
|
| MD5 |
12dd8e7bcc19927440a7ce889d6779e3
|
|
| BLAKE2b-256 |
9b06983c8707ca80b1a8a97b5db9de8bb768de1941d513340af0daa7096825e4
|
File details
Details for the file redis_http_client-0.1.1-py3-none-any.whl.
File metadata
- Download URL: redis_http_client-0.1.1-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eb310b1b48f772cc8caa723f6e80441eb09d516f58cf6f4fa9c459b41a59d571
|
|
| MD5 |
3d60fb99870ee439f1b99fe8a4039a31
|
|
| BLAKE2b-256 |
e94bb770b6184b641ebd2d49c8345882b4735b687f19cd607ec1d7b477305496
|