MCPcopy Create free account
hub / github.com/EasyIME/PIME / _on_request_token

Method _on_request_token

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

Source from the content-addressed store, hash-verified

414 return url + "?" + urllib.parse.urlencode(args)
415
416 def _on_request_token(
417 self,
418 authorize_url: str,
419 callback_uri: Optional[str],
420 response: httpclient.HTTPResponse,
421 ) -> None:
422 handler = cast(RequestHandler, self)
423 request_token = _oauth_parse_response(response.body)
424 data = (
425 base64.b64encode(escape.utf8(request_token["key"]))
426 + b"|"
427 + base64.b64encode(escape.utf8(request_token["secret"]))
428 )
429 handler.set_cookie("_oauth_request_token", data)
430 args = dict(oauth_token=request_token["key"])
431 if callback_uri == "oob":
432 handler.finish(authorize_url + "?" + urllib.parse.urlencode(args))
433 return
434 elif callback_uri:
435 args["oauth_callback"] = urllib.parse.urljoin(
436 handler.request.full_url(), callback_uri
437 )
438 handler.redirect(authorize_url + "?" + urllib.parse.urlencode(args))
439
440 def _oauth_access_token_url(self, request_token: Dict[str, Any]) -> str:
441 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