MCPcopy
hub / github.com/authlib/authlib / extract_header

Function extract_header

authlib/jose/util.py:9–22  ·  view source on GitHub ↗
(header_segment, error_cls)

Source from the content-addressed store, hash-verified

7
8
9def extract_header(header_segment, error_cls):
10 if len(header_segment) > 256000:
11 raise ValueError("Value of header is too long")
12
13 header_data = extract_segment(header_segment, error_cls, "header")
14
15 try:
16 header = json_loads(header_data.decode("utf-8"))
17 except ValueError as e:
18 raise error_cls(f"Invalid header string: {e}") from e
19
20 if not isinstance(header, dict):
21 raise error_cls("Header must be a json object")
22 return header
23
24
25def extract_segment(segment, error_cls, name="payload"):

Calls 3

json_loadsFunction · 0.90
extract_segmentFunction · 0.85
decodeMethod · 0.80

Used in the wild real call sites across dependent graphs

searching dependent graphs…