404 "Domain not found." when trying to query Calendar Resources list.
I am using the Python client library in Python 3.5 on a Mac. I have created a project from a Google account with super-admin rights on the domain, created some Service Account credentials and downloaded them in JSON form to crr-service-secret.json, and granted all four scopes to the project ID. Yet every time I run the below code, I get an error that reads:
googleapiclient.errors.HttpError: <HttpError 404 when requesting https://www.googleapis.com/admin/directory/v1/customer/my_customer/resources/calendars?alt=json returned "Domain not found.">
Calls to other API endpoints work just fine. Is this a bug?
from oauth2client.service_account import ServiceAccountCredentials
from apiclient.discovery import build
import json
from httplib2 import Http
scopes = ['https://www.googleapis.com/auth/calendar',
'https://www.googleapis.com/auth/admin.directory.resource.calendar',
'https://www.googleapis.com/auth/admin.directory.resource.calendar.readonly',
'https://www.googleapis.com/auth/calendar.readonly']
credentials = ServiceAccountCredentials.from_json_keyfile_name(
'crr-service-secret.json',
scopes=scopes
)
http = credentials.authorize(Http())
directory = build('admin', 'directory_v1', http=http)
response = directory.resources().calendars().list(customer='my_customer')
print(response.execute(http=http))
I'm not sure, you may have to use create_delegated using an administrator account first.
Either way, it's better to ask this question on stackoverflow, as unfortunately we do not maintain the APIs themselves, only the client library. This is an issue with API usage itself, and we unfortunately do not have expertise in every API that this client can access.
I'm closing this issue, but please feel free to comment if there is anything else I can help you with.
Thanks, I was able to reproduce the same symptom with the Ruby client so it's either my fault or Google's. On Apr 7, 2016 7:03 PM, "Jon Wayne Parrott" [email protected] wrote:
I'm not sure, you may have to use create_delegate using an administrator account first.
Either way, it's better to ask this question on stackoverflow, as unfortunately we do not maintain the APIs themselves, only the client library. This is an issue with API usage itself, and we unfortunately do not have expertise in every API that this client can access.
I'm closing this issue, but please feel free to comment if there is anything else I can help you with.
— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/google/google-api-python-client/issues/214#issuecomment-207131452