(self, request_token: Dict[str, Any])
| 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() |
| 457 | url = self._OAUTH_ACCESS_TOKEN_URL # type: ignore |
| 458 | args = dict( |
| 459 | oauth_consumer_key=escape.to_basestring(consumer_token["key"]), |
| 460 | oauth_token=escape.to_basestring(request_token["key"]), |
| 461 | oauth_signature_method="HMAC-SHA1", |
| 462 | oauth_timestamp=str(int(time.time())), |
| 463 | oauth_nonce=escape.to_basestring(binascii.b2a_hex(uuid.uuid4().bytes)), |
| 464 | oauth_version="1.0", |
| 465 | ) |
| 466 | if "verifier" in request_token: |
| 467 | args["oauth_verifier"] = request_token["verifier"] |
| 468 | |
| 469 | if getattr(self, "_OAUTH_VERSION", "1.0a") == "1.0a": |
| 470 | signature = _oauth10a_signature( |
| 471 | consumer_token, "GET", url, args, request_token |
| 472 | ) |
| 473 | else: |
| 474 | signature = _oauth_signature( |
| 475 | consumer_token, "GET", url, args, request_token |
| 476 | ) |
| 477 | |
| 478 | args["oauth_signature"] = signature |
| 479 | return url + "?" + urllib.parse.urlencode(args) |
| 480 | |
| 481 | def _oauth_consumer_token(self) -> Dict[str, Any]: |
| 482 | """Subclasses must override this to return their OAuth consumer keys. |
no test coverage detected