MCPcopy
hub / github.com/tornadoweb/tornado / _oauth_parse_response

Function _oauth_parse_response

tornado/auth.py:1225–1236  ·  view source on GitHub ↗
(body: bytes)

Source from the content-addressed store, hash-verified

1223
1224
1225def _oauth_parse_response(body: bytes) -> Dict[str, Any]:
1226 # I can't find an officially-defined encoding for oauth responses and
1227 # have never seen anyone use non-ascii. Leave the response in a byte
1228 # string for python 2, and use utf8 on python 3.
1229 body_str = escape.native_str(body)
1230 p = urllib.parse.parse_qs(body_str, keep_blank_values=False)
1231 token = dict(key=p["oauth_token"][0], secret=p["oauth_token_secret"][0])
1232
1233 # Add the extra parameters the Provider included to the token
1234 special = ("oauth_token", "oauth_token_secret")
1235 token.update((k, p[k][0]) for k in p if k not in special)
1236 return token

Callers 2

_on_request_tokenMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected