initial commit

This commit is contained in:
Hartmut Bauer committed 2025-12-17 17:02:05 +01:00
commit f8971c4821
18 files changed
+1067

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
"""Utils and helpers."""
from __future__ import annotations
import re
from http.cookies import SimpleCookie
REGEXP_COOKIE_EXPIRES = re.compile("(;\\s?expires=(.*)(;|$))", re.IGNORECASE)
def normalize_cookies(cookies: list[str]) -> SimpleCookie:
"""Normalize non RFC-compliant cookies."""
result: SimpleCookie = SimpleCookie()
for cookie in cookies:
result.load(REGEXP_COOKIE_EXPIRES.sub("", cookie))
return result