@@ -187,8 +187,10 @@ 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='{}')
190192 ** kwargs # Relay all extra parameters to underlying requests
191- ):
193+ ): # Returns the json object came from the OAUTH2 response
192194
193195 # Handle deprecated params parameter
194196 params = kwargs .pop ('params' , None )
@@ -784,14 +786,14 @@ def _obtain_token(
784786 also_save_rt = False ,
785787 on_obtaining_tokens = None ,
786788 * args , ** kwargs ):
787- _data = data .copy () if data else {} # to prevent side effect
789+ _data = data .copy () # to prevent side effect
788790
789791 # Handle deprecated params parameter. It was removed as an argument here and in BaseClient._obtain_token(),
790792 # and BaseClient._obtain_token() provides the deprecation warning if params is used.
791793 params = kwargs .pop ('params' , None )
792794
793795 resp = super (Client , self )._obtain_token (
794- grant_type , data = _data , * args , ** kwargs )
796+ grant_type , _data , * args , ** kwargs )
795797 if "error" not in resp :
796798 _resp = resp .copy ()
797799 RT = "refresh_token"
0 commit comments