Allow OAuth2BearerHandler to be used as auth parameter for API
authorHarmon <Harmon758@gmail.com>
Fri, 7 Jan 2022 11:22:39 +0000 (05:22 -0600)
committerHarmon <Harmon758@gmail.com>
Sat, 8 Jan 2022 00:19:27 +0000 (18:19 -0600)
tweepy/__init__.py
tweepy/auth.py

index 3747b1b51cccc2658225e5d0da9b1286a30c5ce7..69069d15dffc266e8be735cc296b634f58716958 100644 (file)
@@ -11,7 +11,8 @@ __license__ = 'MIT'
 
 from tweepy.api import API
 from tweepy.auth import (
-    AppAuthHandler, OAuthHandler, OAuth2AppHandler, OAuth2Handler
+    AppAuthHandler, OAuthHandler, OAuth2AppHandler, OAuth2BearerHandler,
+    OAuth2Handler
 )
 from tweepy.cache import Cache, FileCache, MemoryCache
 from tweepy.client import Client, Response
index 7ac26ac78109b7d3a1ea93d643a80dc400e5253c..472004fae0f2cfdb17c9fd9995636ad99a8cb717 100644 (file)
@@ -172,6 +172,9 @@ class OAuth2BearerHandler(AuthBase):
         request.headers['Authorization'] = 'Bearer ' + self.bearer_token
         return request
 
+    def apply_auth(self):
+        return self
+
 
 class OAuth2AppHandler(AuthHandler):
     """Application-only authentication handler"""