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

Method _on_request_token

tornado/auth.py:431–453  ·  view source on GitHub ↗
(
        self,
        authorize_url: str,
        callback_uri: Optional[str],
        response: httpclient.HTTPResponse,
    )

Source from the content-addressed store, hash-verified

429 return url + "?" + urllib.parse.urlencode(args)
430
431 def _on_request_token(
432 self,
433 authorize_url: str,
434 callback_uri: Optional[str],
435 response: httpclient.HTTPResponse,
436 ) -> None:
437 handler = cast(RequestHandler, self)
438 request_token = _oauth_parse_response(response.body)
439 data = (
440 base64.b64encode(escape.utf8(request_token["key"]))
441 + b"|"
442 + base64.b64encode(escape.utf8(request_token["secret"]))
443 )
444 handler.set_cookie("_oauth_request_token", data)
445 args = dict(oauth_token=request_token["key"])
446 if callback_uri == "oob":
447 handler.finish(authorize_url + "?" + urllib.parse.urlencode(args))
448 return
449 elif callback_uri:
450 args["oauth_callback"] = urllib.parse.urljoin(
451 handler.request.full_url(), callback_uri
452 )
453 handler.redirect(authorize_url + "?" + urllib.parse.urlencode(args))
454
455 def _oauth_access_token_url(self, request_token: Dict[str, Any]) -> str:
456 consumer_token = self._oauth_consumer_token()

Callers 2

authorize_redirectMethod · 0.95
authenticate_redirectMethod · 0.80

Calls 5

_oauth_parse_responseFunction · 0.85
full_urlMethod · 0.80
redirectMethod · 0.80
set_cookieMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected