Prints the emails and names of the first 10 users in the domain. '''Shows basic usage of the Admin SDK Directory API. # If modifying these scopes, delete the file token.json. Include the following code in quickstart.py:įrom googleapiclient.discovery import buildįrom google_auth_oauthlib.flow import InstalledAppFlowįrom import Requestįrom import Credentials 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 A Google account in that domain with administrator privileges.A Google Workspace domain with API access enabled.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 'Admin SDK API'. A Google Cloud Platform project with the API enabled.To run this quickstart, you need the following prerequisites: Complete the steps described in the rest of this page to create a simple PythonĬommand-line application that makes requests to the Admin SDK API.