From 7f36c03e469ccffebadeacab54d3cdf711c77971 Mon Sep 17 00:00:00 2001 From: Harmon Date: Wed, 30 Dec 2020 00:29:21 -0600 Subject: [PATCH] Check consumer key and secret type when initializing OAuthHandler Resolves #1489 --- tweepy/auth.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tweepy/auth.py b/tweepy/auth.py index 1d138bd..7cdd010 100644 --- a/tweepy/auth.py +++ b/tweepy/auth.py @@ -36,6 +36,13 @@ class OAuthHandler(AuthHandler): OAUTH_ROOT = '/oauth/' def __init__(self, consumer_key, consumer_secret, callback=None): + if not isinstance(consumer_key, (str, bytes)): + raise TypeError("Consumer key must be string or bytes, not " + + type(consumer_key).__name__) + if not isinstance(consumer_secret, (str, bytes)): + raise TypeError("Consumer secret must be string or bytes, not " + + type(consumer_secret).__name__) + self.consumer_key = consumer_key self.consumer_secret = consumer_secret self.access_token = None -- 2.25.1