From 99f3583d99ac9a0003273318e7628235bba707f0 Mon Sep 17 00:00:00 2001 From: Harmon Date: Fri, 7 Jan 2022 07:10:15 -0600 Subject: [PATCH] Allow passing access token and secret directly to OAuthHandler.__init__ --- tweepy/auth.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 = {} -- 2.25.1