diff options
Diffstat (limited to 'day7/utils.py')
| -rw-r--r-- | day7/utils.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/day7/utils.py b/day7/utils.py index c17a02d..b00c5c2 100644 --- a/day7/utils.py +++ b/day7/utils.py @@ -15,6 +15,10 @@ FIRST_LINE_PATTERN = re.compile(rf'{"(" + "|".join(HTTP_METHODS) + ")"} {URL_REG def add_text_headers(status, html: str): + """ + Добавляет заголовки к ответной html-странице + """ + return '\r\n'.join([ status, f'Date: {strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime())}', @@ -47,6 +51,10 @@ def parse_cookies(cookies_line: str): def format_cookies(cookies: dict): + """ + Формирование cookie-строки из переданного словаря. + """ + pairs = [] for key, value in cookies: pairs.append(f'{key}={value}') |