so I have the following problem:
I want to manipulate a calendar(my private google calendar) using GoogleFunctions with python backend.I have now followed an code example (which inserts an event) and in the google console it is also shown that a call has taken place. Now I'm just wondering which calendar I'm modifying?
The problem for me is, as soon as I enter the calendarId of my private calendar, the function runs on an error. But actually the service user has all permissions. If I understand it correctly, then I can manipulate all calendars within the organization with the Service user?
So that's my code. It works so far. Now I only ask myself, can I see the calendar I am modifying somewhere?
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
from google.oauth2 import service_account
SUBJECT = 's.........415.iam.gserviceaccount.com'
def main():
# create credntials
credentials = service_account.Credentials.from_service_account_file(SERVICE_ACCOUNT_FILE, scopes=SCOPES)
delegated_credentials = credentials.with_subject(SUBJECT)
service = build('calendar', 'v3', credentials=delegated_credentials)
d = datetime.utcnow().date()
tomorrow = datetime(d.year, d.month, d.day, 10)
start = tomorrow.isoformat()
end = (tomorrow).isoformat()
body={"summary": 'Hello there, Automating calendar',
"description": 'Google calendar with python',
"start": {"dateTime": start, "timeZone": 'Asia/Karachi'},
"end": {"dateTime": end, "timeZone": 'Asia/Karachi'},
}
event = service.events().insert(calendarId=SUBJECT,body=body).execute()
if __name__ == "__main__":
main()