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

Method _oauth_request_parameters

tornado/auth.py:512–545  ·  view source on GitHub ↗

Returns the OAuth parameters as a dict for the given request. parameters should include all POST arguments and query string arguments that will be sent with the request.

(
        self,
        url: str,
        access_token: Dict[str, Any],
        parameters: Dict[str, Any] = {},
        method: str = "GET",
    )

Source from the content-addressed store, hash-verified

510 raise NotImplementedError()
511
512 def _oauth_request_parameters(
513 self,
514 url: str,
515 access_token: Dict[str, Any],
516 parameters: Dict[str, Any] = {},
517 method: str = "GET",
518 ) -> Dict[str, Any]:
519 """Returns the OAuth parameters as a dict for the given request.
520
521 parameters should include all POST arguments and query string arguments
522 that will be sent with the request.
523 """
524 consumer_token = self._oauth_consumer_token()
525 base_args = dict(
526 oauth_consumer_key=escape.to_basestring(consumer_token["key"]),
527 oauth_token=escape.to_basestring(access_token["key"]),
528 oauth_signature_method="HMAC-SHA1",
529 oauth_timestamp=str(int(time.time())),
530 oauth_nonce=escape.to_basestring(binascii.b2a_hex(uuid.uuid4().bytes)),
531 oauth_version="1.0",
532 )
533 args = {}
534 args.update(base_args)
535 args.update(parameters)
536 if getattr(self, "_OAUTH_VERSION", "1.0a") == "1.0a":
537 signature = _oauth10a_signature(
538 consumer_token, method, url, args, access_token
539 )
540 else:
541 signature = _oauth_signature(
542 consumer_token, method, url, args, access_token
543 )
544 base_args["oauth_signature"] = escape.to_basestring(signature)
545 return base_args
546
547 def get_auth_http_client(self) -> httpclient.AsyncHTTPClient:
548 """Returns the `.AsyncHTTPClient` instance to be used for auth requests.

Callers 2

twitter_requestMethod · 0.80
getMethod · 0.80

Calls 4

_oauth_consumer_tokenMethod · 0.95
_oauth10a_signatureFunction · 0.85
_oauth_signatureFunction · 0.85
timeMethod · 0.80

Tested by 1

getMethod · 0.64