I am trying to get events from a Google Calendar without prompting consent page to the user. I have used a service account for this (json file with all the data)
But when I ran the script I am getting this
from google.oauth2 import service_account
import googleapiclient.discovery
import time
import jwt
SCOPES = ['https://www.googleapis.com/auth/calendar.readonly']
SERVICE_ACCOUNT_FILE = '/Users/user/Downloads/XXXXXXXX.json'
credentials = service_account.Credentials.from_service_account_file(
SERVICE_ACCOUNT_FILE, scopes=SCOPES)
service = googleapiclient.discovery.build('calendar', 'v3', credentials=credentials)
page_token = None
calendar_list_entry = service.calendarList().get(calendarId='[email protected]').execute()
Traceback (most recent call last): File "/Users/user/Downloads/blender.py", line 16, in calendar_list_entry = service.calendarList().get(calendarId='[email protected]').execute() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/googleapiclient/_helpers.py", line 131, in positional_wrapper return wrapped(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/googleapiclient/http.py", line 937, in execute raise HttpError(resp, content, uri=self.uri) googleapiclient.errors.HttpError: <HttpError 404 when requesting https://www.googleapis.com/calendar/v3/users/me/calendarList/XXXXXXXX%40group.calendar.google.com?alt=json returned "Not Found". Details: "[{'domain': 'global', 'reason': 'notFound', 'message': 'Not Found'}]">`