MCPcopy Create free account
hub / github.com/authlib/authlib / _fetch_token

Method _fetch_token

authlib/oauth2/client.py:441–460  ·  view source on GitHub ↗
(
        self, url, body="", headers=None, auth=None, method="POST", **kwargs
    )

Source from the content-addressed store, hash-verified

439 return self.token
440
441 def _fetch_token(
442 self, url, body="", headers=None, auth=None, method="POST", **kwargs
443 ):
444 if method.upper() == "POST":
445 resp = self.session.post(
446 url, data=dict(url_decode(body)), headers=headers, auth=auth, **kwargs
447 )
448 else:
449 if "?" in url:
450 url = "&".join([url, body])
451 else:
452 url = "?".join([url, body])
453 resp = self.session.request(
454 method, url, headers=headers, auth=auth, **kwargs
455 )
456
457 for hook in self.compliance_hook["access_token_response"]:
458 resp = hook(resp)
459
460 return self.parse_response_token(resp)
461
462 def _refresh_token(
463 self, url, refresh_token=None, body="", headers=None, auth=None, **kwargs

Callers 1

fetch_tokenMethod · 0.95

Calls 4

parse_response_tokenMethod · 0.95
url_decodeFunction · 0.90
postMethod · 0.80
requestMethod · 0.45

Tested by

no test coverage detected