![]() # TODO(developer) - Handle errors from gmail API.įrom the command-line, execute the following command: python quickstart.py Results = ers().labels().list(userId='me').execute() Service = build('gmail', 'v1', credentials=creds) If creds and creds.expired and creds.refresh_token:įlow = om_client_secrets_file( # If there are no (valid) credentials available, let the user log in. # created automatically when the authorization flow completes for the firstĬreds = om_authorized_user_file('token.json', SCOPES) # The file token.json stores the user's access and refresh tokens, and is # If modifying these scopes, delete the file token.json. Include the following code in quickstart.py:įrom import Requestįrom import Credentialsįrom google_auth_oauthlib.flow import InstalledAppFlowįrom googleapiclient.discovery import buildįrom googleapiclient.errors import HttpError ![]() In your working directory, create a file named quickstart.py.To install the Google client library for Python, run the following command: pip install -upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlibįor alternate installation options, refer to the Python library's Step 1: Install the Google client library To learn how toĬreate credentials for a desktop application, refer to Authorization credentials for a desktop application.Note: For this quickstart, you are enabling the "Gmail API". ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |