auth.py 298 B

1234567891011
  1. def _make_key_value(val):
  2. return val.strip().split("=", 1)
  3. def parse_auth_header(header):
  4. if isinstance(header, bytes):
  5. header = header.decode("latin1")
  6. try:
  7. return dict(map(_make_key_value, header.split(" ", 1)[1].split(",")))
  8. except Exception:
  9. return {}