From: Harmon Date: Wed, 30 Dec 2020 06:29:21 +0000 (-0600) Subject: Check consumer key and secret type when initializing OAuthHandler X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7f36c03e469ccffebadeacab54d3cdf711c77971;p=tweepy.git Check consumer key and secret type when initializing OAuthHandler Resolves #1489 --- 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