Deprecate AppAuthHandler alias
authorHarmon <Harmon758@gmail.com>
Fri, 7 Jan 2022 13:45:24 +0000 (07:45 -0600)
committerHarmon <Harmon758@gmail.com>
Sat, 8 Jan 2022 00:19:27 +0000 (18:19 -0600)
tweepy/auth.py

index 37af86ae8e32377a21aae2514511c61c4f4e58d3..276b565bf1439aa36b3a10924b71d4da347abfb1 100644 (file)
@@ -7,6 +7,7 @@ from hashlib import sha256
 import logging
 from urllib.parse import parse_qs
 import secrets
+import warnings
 
 import requests
 from requests.auth import AuthBase, HTTPBasicAuth
@@ -126,7 +127,20 @@ class OAuth2AppHandler:
     def apply_auth(self):
         return OAuth2BearerHandler(self._bearer_token)
 
-AppAuthHandler = OAuth2AppHandler
+
+class AppAuthHandler(OAuth2AppHandler):
+    """Alias for :class:`OAuth2AppHandler`
+
+    .. deprecated:: 4.5
+        Use :class:`OAuth2AppHandler` instead.
+    """
+
+    def __init__(self, consumer_key, consumer_secret):
+        warnings.warn(
+            "AppAuthHandler is deprecated; use OAuth2AppHandler instead.",
+            DeprecationWarning
+        )
+        super().__init__(consumer_key, consumer_secret)
 
 
 class OAuth2BearerHandler(AuthBase):