-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGoogleCalendarUpdateEvent.py
27 lines (24 loc) · 1.02 KB
/
GoogleCalendarUpdateEvent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import json
from googleapiclient.discovery import build
from google.oauth2.credentials import Credentials
def lambda_handler(event, context):
creds = Credentials(token=event['access_token'],
refresh_token=event['refresh_token'],
client_id=event['client_id'],
token_uri=event['token_uri'],
client_secret=event['client_secret'])
service = build('calendar', 'v3', credentials=creds, cache_discovery=False)
event = {
'summary': event['calsumm'],
'location': event['calloc'],
'description': event['caldesc'],
'attendees': [
{'email': event['mail']['id1']},
{'email': event['mail']['id2']},
],
}
event = service.events().patch(calendarId='primary',eventId = event['caleveid'], body=event).execute()
return {
'statusCode': 200,
'body': json.dumps('Success!')
}