refresh_token : print ( 'Requesting new token' ) creds. from_authorized_user_file ( token_file, SCOPES ) # If there are no (valid) credentials available, let the user log in. exists ( token_file ): creds = Credentials. # created automatically when the authorization flow completes for the first SCOPES = def main (): token_file = 'secrets/token-generated.json' creds = None # The file token.json stores the user's access and refresh tokens, and is # If modifying these scopes, delete the file in secrets/token xxx.json. # and it will refresh the token accordingly # Can run this code to verify the token is the correct user # If creating for first time download the json `credentials.json` from OAuth 2.0 Client IDs From _future_ import print_function import os.path from import Request from import Credentials from google_auth_oauthlib.flow import InstalledAppFlow from googleapiclient.discovery import build from googleapiclient.errors import HttpError # from googleapiclient.http import MediaFileUpload
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |