@@ -187,10 +187,8 @@ def _obtain_token( # The verb "obtain" is influenced by OAUTH2 RFC 6749
187187 data = None , # All relevant data, which will go into the http body
188188 headers = None , # a dict to be sent as request headers
189189 post = None , # A callable to replace requests.post(), for testing.
190- # Such as: lambda url, **kwargs:
191- # Mock(status_code=200, text='{}')
192190 ** kwargs # Relay all extra parameters to underlying requests
193- ): # Returns the json object came from the OAUTH2 response
191+ ):
194192
195193 # Handle deprecated params parameter
196194 params = kwargs .pop ('params' , None )
@@ -782,13 +780,18 @@ def __init__(self,
782780 self .on_updating_rt = on_updating_rt
783781
784782 def _obtain_token (
785- self , grant_type , params = None , data = None ,
783+ self , grant_type , data = None ,
786784 also_save_rt = False ,
787785 on_obtaining_tokens = None ,
788786 * args , ** kwargs ):
789- _data = data .copy () # to prevent side effect
787+ _data = data .copy () if data else {} # to prevent side effect
788+
789+ # Handle deprecated params parameter. It was removed as an argument here and in BaseClient._obtain_token(),
790+ # and BaseClient._obtain_token() provides the deprecation warning if params is used.
791+ params = kwargs .pop ('params' , None )
792+
790793 resp = super (Client , self )._obtain_token (
791- grant_type , params , _data , * args , ** kwargs )
794+ grant_type , data = _data , * args , ** kwargs )
792795 if "error" not in resp :
793796 _resp = resp .copy ()
794797 RT = "refresh_token"
0 commit comments