Replace type equality check in OAuthHandler initialization
authorHarmon <Harmon758@gmail.com>
Sun, 27 Dec 2020 22:53:30 +0000 (16:53 -0600)
committerHarmon <Harmon758@gmail.com>
Sun, 27 Dec 2020 22:54:44 +0000 (16:54 -0600)
With isinstance usage

tweepy/auth.py

index 7e82b407480a88f2a41bf740fc6b698537d11065..3cd7efa886272cc920aeac5c8df7b30c13d39433 100644 (file)
@@ -36,10 +36,10 @@ class OAuthHandler(AuthHandler):
     OAUTH_ROOT = '/oauth/'
 
     def __init__(self, consumer_key, consumer_secret, callback=None):
-        if type(consumer_key) == str:
+        if isinstance(consumer_key, str):
             consumer_key = consumer_key.encode('ascii')
 
-        if type(consumer_secret) == str:
+        if isinstance(consumer_secret, str):
             consumer_secret = consumer_secret.encode('ascii')
 
         self.consumer_key = consumer_key