Spaces:
Running
Running
File size: 463 Bytes
a55ea57 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | """Redis connection URL helpers for worker transports."""
from __future__ import annotations
from urllib.parse import quote
def redis_connection_url(
host: str,
port: str | int,
password: str | None,
*,
database: int = 0,
) -> str:
"""Build a Redis URL, percent-encoding credentials when authentication is enabled."""
auth = f":{quote(password, safe='')}@" if password else ""
return f"redis://{auth}{host}:{port}/{database}"
|