Allow passing access token and secret directly to OAuthHandler.__init__
authorHarmon <Harmon758@gmail.com>
Fri, 7 Jan 2022 13:10:15 +0000 (07:10 -0600)
committerHarmon <Harmon758@gmail.com>
Sat, 8 Jan 2022 00:19:27 +0000 (18:19 -0600)
tweepy/auth.py

index ff83ef612294140dfa2aa3b1b02097a59acbcece..547b09e4e8a52ac62170986f20575bd0343dcfe5 100644 (file)
@@ -23,7 +23,8 @@ log = logging.getLogger(__name__)
 
 class OAuthHandler:
 
-    def __init__(self, consumer_key, consumer_secret, callback=None):
+    def __init__(self, consumer_key, consumer_secret, access_token=None,
+                 access_token_secret=None, callback=None):
         if not isinstance(consumer_key, (str, bytes)):
             raise TypeError("Consumer key must be string or bytes, not "
                             + type(consumer_key).__name__)
@@ -33,8 +34,8 @@ class OAuthHandler:
 
         self.consumer_key = consumer_key
         self.consumer_secret = consumer_secret
-        self.access_token = None
-        self.access_token_secret = None
+        self.access_token = access_token
+        self.access_token_secret = access_token_secret
         self.callback = callback
         self.username = None
         self.request_token = {}