This commit is contained in:
2025-11-17 14:37:50 -03:00
parent d2abaec021
commit 7f41704d90
51 changed files with 733 additions and 495 deletions

View File

@@ -1,4 +1,5 @@
import os
from http.cookies import SimpleCookie
ROOT = os.path.abspath(os.path.dirname(__file__))
@@ -10,3 +11,17 @@ def get_file_path(name: str) -> str:
def read_file_path(name: str) -> str:
with open(get_file_path(name)) as f:
return f.read()
def parse_cookies(cookies: list[str] | None) -> dict[str, str]:
parsed_cookies = {}
if not cookies:
return parsed_cookies
for s in cookies:
c = SimpleCookie()
c.load(s)
parsed_cookies.update({k: morsel.value for k, morsel in c.items()})
return parsed_cookies