MCPcopy
hub / github.com/slackapi/python-slack-sdk / parse_body

Function parse_body

integration_tests/samples/token_rotation/util.py:6–19  ·  view source on GitHub ↗
(body: str, content_type: Optional[str])

Source from the content-addressed store, hash-verified

4
5
6def parse_body(body: str, content_type: Optional[str]) -> Dict[str, Any]:
7 if not body:
8 return {}
9 if (content_type is not None and content_type == "application/json") or body.startswith("{"):
10 return json.loads(body)
11 else:
12 if "payload" in body: # This is not JSON format yet
13 params = dict(parse_qsl(body))
14 if params.get("payload") is not None:
15 return json.loads(params.get("payload"))
16 else:
17 return {}
18 else:
19 return dict(parse_qsl(body))
20
21
22def extract_is_enterprise_install(payload: Dict[str, Any]) -> Optional[bool]:

Callers 4

slack_appFunction · 0.90
slack_appFunction · 0.90
slack_appFunction · 0.90
slack_appFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected