MCPcopy
hub / github.com/Rapptz/discord.py / json_or_text

Function json_or_text

discord/http.py:110–119  ·  view source on GitHub ↗
(response: aiohttp.ClientResponse)

Source from the content-addressed store, hash-verified

108
109
110async def json_or_text(response: aiohttp.ClientResponse) -> Union[Dict[str, Any], str]:
111 text = await response.text(encoding='utf-8')
112 try:
113 if response.headers['content-type'] == 'application/json':
114 return utils._from_json(text)
115 except KeyError:
116 # Thanks Cloudflare
117 pass
118
119 return text
120
121
122class MultipartParameters(NamedTuple):

Callers 2

requestMethod · 0.85
requestMethod · 0.85

Calls 1

textMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…