educative.io

Educative

Function definition

Which function is being called internally for refresh_token()? Can you please share any references for that as I am currently running it in my local machine.

@Geetanshu_Mathur Here is the definition for the refresh_token() function.

from json import load, dumps
from google.auth.transport.requests import Request

def refresh_token(creds):
—try:
------creds.refresh(Request())
------json_data = {“access_token”: f"{creds.token}",“refresh_token”: f"{creds.refresh_token}", “expiry”: f"{credentials.expiry}".replace(" ", “T”)}
------formatted_json = dumps(json_data, indent=4)
------print(formatted_json)
—except Exception as e:
------print(“Please enter your access token data in the token.json file”)