[Python] Unable to fetch user list from google workspace due to: Resource Not Found: userKey

Discussão em 'Python' iniciado por Stack, Maio 13, 2025.

  1. Stack

    Stack Membro Participativo

    I was trying to fetch the user list using the below approach:

    def getGsuiteUserData(self, data):
    access_token = data.get('access_token')
    if not access_token:
    raise Exception("access token is required.")

    headers = {
    'Authorization': f'Bearer {access_token}'
    }

    params = {
    'domain': ''
    }

    try:
    # Fetch users
    response = self._requestsMod.get("https://www.googleapis.com/admin/directory/v1/users", headers=headers, params=params)
    response.raise_for_status()
    user_data = response.json()
    except Exception as e:
    raise e


    The above approach was working fine few days ago but when i tried to fetch the user list, i am getting the below error:

    {"message": "Resource Not Found: userKey", "domain": "global", "reason": "notFound"}


    I did update the params with the below values:

    params = {
    'domain': 'my_domain' # working
    }

    params = {
    'customer': 'my_customer' # working
    }


    My question is, why domain with empty value was working fine but as of now it is breaking and raising an error?

    Continue reading...

Compartilhe esta Página