(body: bytes)
| 1223 | |
| 1224 | |
| 1225 | def _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 |
no outgoing calls
no test coverage detected