Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
add type annotations to federation auth header parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
jcgruenhage committed Nov 27, 2021
1 parent 8c8d84e commit 69f606c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions synapse/federation/transport/server/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import logging
import re
from http import HTTPStatus
from typing import Optional, Tuple
from typing import Dict, Optional, Tuple

from synapse.api.errors import Codes, FederationDeniedError, SynapseError
from synapse.api.urls import FEDERATION_V1_PREFIX
Expand Down Expand Up @@ -161,7 +161,9 @@ def _parse_auth_header(header_bytes: bytes) -> Tuple[str, str, str, Optional[str
try:
header_str = header_bytes.decode("utf-8")
params = header_str.split(" ")[1].split(",")
param_dict = dict(kv.split("=") for kv in params)
param_dict: Dict[str, str] = {
k: v for k, v in [param.split("=", maxsplit=1) for param in params]
}

def strip_quotes(value):
if value.startswith('"'):
Expand Down

0 comments on commit 69f606c

Please sign in to comment.