From: Harmon Date: Fri, 7 Jan 2022 13:10:15 +0000 (-0600) Subject: Allow passing access token and secret directly to OAuthHandler.__init__ X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=99f3583d99ac9a0003273318e7628235bba707f0;p=tweepy.git Allow passing access token and secret directly to OAuthHandler.__init__ --- diff --git a/tweepy/auth.py b/tweepy/auth.py index ff83ef6..547b09e 100644 --- a/tweepy/auth.py +++ b/tweepy/auth.py @@ -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 = {}