class_docstr: Twitter OAuth authentication.
  
  To authenticate with Twitter, register your application with
  Twitter at http://twitter.com/apps. Then copy your Consumer Key
  and Consumer Secret to the application
  `~tornado.web.Application.settings` ``twitter_consumer_key`` and
  ``twitter_consumer_secret``. Use this mixin on the handler for the
  URL you registered as your application's callback URL.
  
  When your application is set up, you can use this mixin like this
  to authenticate the user with Twitter and get access to their stream:
  
  .. testcode::
  
      class TwitterLoginHandler(tornado.web.RequestHandler,
                                tornado.auth.TwitterMixin):
          async def get(self):
              if self.get_argument("oauth_token", None):
                  user = await self.get_authenticated_user()
                  # Save the user using e.g. set_signed_cookie()
              else:
                  await self.authorize_redirect()
  
  .. testoutput::
     :hide:
  
  The user object returned by `~OAuthMixin.get_authenticated_user`
  includes the attributes ``username``, ``name``, ``access_token``,
  and all of the custom Twitter user attributes described at
  https://dev.twitter.com/docs/api/1.1/get/users/show
  
  .. deprecated:: 6.3
     This class refers to version 1.1 of the Twitter API, which has been
     deprecated by Twitter. Since Twitter has begun to limit access to its
     API, this class will no longer be updated and will be removed in the
     future.
class_docstr_tok: ["Twitter","OAuth","authentication",".","To","authenticate","with","Twitter",",","register","your","application","with","Twitter","at","http",":","\/\/twitter.com\/apps",".","Then","copy","your","Consumer","Key","and","Consumer","Secret","to","the","application","`","~tornado.web.Application.settings","`","``","twitter_consumer_key","``","and","``","twitter_consumer_secret","``",".","Use","this","mixin","on","the","handler","for","the","URL","you","registered","as","your","application","'s","callback","URL",".","When","your","application","is","set","up",",","you","can","use","this","mixin","like","this","to","authenticate","the","user","with","Twitter","and","get","access","to","their","stream",":","..","testcode",":",":","class","TwitterLoginHandler","(","tornado.web.RequestHandler",",","tornado.auth.TwitterMixin",")",":","async","def","get","(","self",")",":","if","self.get_argument","(","``","oauth_token","''",",","None",")",":","user","=","await","self.get_authenticated_user","(",")","#","Save","the","user","using","e.g",".","set_signed_cookie","(",")","else",":","await","self.authorize_redirect","(",")","..","testoutput",":",":",":","hide",":","The","user","object","returned","by","`","~OAuthMixin.get_authenticated_user","`","includes","the","attributes","``","username","``",",","``","name","``",",","``","access_token","``",",","and","all","of","the","custom","Twitter","user","attributes","described","at","https",":","\/\/dev.twitter.com\/docs\/api\/1.1\/get\/users\/show","..","deprecated",":",":","6.3","This","class","refers","to","version","1.1","of","the","Twitter","API",",","which","has","been","deprecated","by","Twitter",".","Since","Twitter","has","begun","to","limit","access","to","its","API",",","this","class","will","no","longer","be","updated","and","will","be","removed","in","the","future","."]
code: def _oauth_consumer_token(self) -> Dict[str, Any]:
      handler = cast(RequestHandler, self)
      handler.require_setting("twitter_consumer_key", "Twitter OAuth")
      handler.require_setting(
          "twitter_consumer_secret", "Twitter OAuth"
      )
      return dict(
          key=handler.settings["twitter_consumer_key"],
          secret=handler.settings["twitter_consumer_secret"],
      )
  
imports: import base64
  import binascii
  import hashlib
  import hmac
  import time
  import urllib.parse
  import uuid
  import warnings
  from tornado import httpclient
  from tornado import escape
  from tornado.httputil import url_concat
  from tornado.util import unicode_type
  from tornado.web import RequestHandler
  from typing import List, Any, Dict, cast, Iterable, Union, Optional
label_desc: Use image node_id 1 for calling the TwitterMixin obj's underlying member method code with example usage: obj._oauth_consumer_token() and returns: dict