jupyterhub_ai_gateway.utils module#
Utility module.
- jupyterhub_ai_gateway.utils.get_rate_limit_key(request: Request) str#
Retrieve the rate limit key from request.
Use the user_id request state from authentication flow as rate limit key.
- Parameters:
request (Request) – The incoming request object.
- Returns:
The rate limit key.
- Return type:
str
- jupyterhub_ai_gateway.utils.match_path(pattern: str, path: str) bool#
Check if the given path matches the specified pattern.
The pattern can contain wildcards (*) that match any single path segment.
- Parameters:
pattern (str) – The pattern to match against.
path (str) – The path to be matched.
- Returns:
True if the path matches the pattern, False otherwise.
- Return type:
bool