main.py
def insert_events(service, calendar_id, events):
    """ Inserts events into the Google Calendar """
    batch = service.new_batch_http_request()
    date_fmt = "%Y/%m/%d %H:%M"
    for event in events:
        start_date = datetime.strptime(event["DateDebut"], date_fmt)
        end_date = datetime.strptime(event["DateFin"], date_fmt)
        event = {
            'summary': event["Title"],
            'location': event["Local"],
            'start': {
                'dateTime': rfc3339.rfc3339(start_date),
                'timeZone': 'Europe/Luxembourg'
            },
            'end': {
                'dateTime': rfc3339.rfc3339(end_date),
                'timeZone': 'Europe/Luxembourg'
            },
            'reminders': {
                'useDefault': False,
                'overrides': [
                    {'method': 'popup', 'minutes': 15},
                ],
            },
        }
        batch.add(
            service.events().insert(calendarId=calendar_id, body=event),
            callback=handle_request_error
        )
    batch.execute()
 Inserts events into the Google Calendar 
Inserts events into the Google Calendar
Inserts events into the Google Calendar
def insert_events(service, calendar_id, events):
    batch = service.new_batch_http_request()
    date_fmt = "%Y/%m/%d %H:%M"
    for event in events:
        start_date = datetime.strptime(event["DateDebut"], date_fmt)
        end_date = datetime.strptime(event["DateFin"], date_fmt)
        event = {
            'summary': event["Title"],
            'location': event["Local"],
            'start': {
                'dateTime': rfc3339.rfc3339(start_date),
                'timeZone': 'Europe/Luxembourg'
            },
            'end': {
                'dateTime': rfc3339.rfc3339(end_date),
                'timeZone': 'Europe/Luxembourg'
            },
            'reminders': {
                'useDefault': False,
                'overrides': [
                    {'method': 'popup', 'minutes': 15},
                ],
            },
        }
        batch.add(
            service.events().insert(calendarId=calendar_id, body=event),
            callback=handle_request_error
        )
    batch.execute()
def insert_events ( service , calendar_id , events ) : batch = service . new_batch_http_request ( ) date_fmt = "%Y/%m/%d %H:%M" for event in events : start_date = datetime . strptime ( event [ "DateDebut" ] , date_fmt ) end_date = datetime . strptime ( event [ "DateFin" ] , date_fmt ) event = { 'summary' : event [ "Title" ] , 'location' : event [ "Local" ] , 'start' : { 'dateTime' : rfc3339 . rfc3339 ( start_date ) , 'timeZone' : 'Europe/Luxembourg' } , 'end' : { 'dateTime' : rfc3339 . rfc3339 ( end_date ) , 'timeZone' : 'Europe/Luxembourg' } , 'reminders' : { 'useDefault' : False , 'overrides' : [ { 'method' : 'popup' , 'minutes' : 15 } , ] , } , } batch . add ( service . events ( ) . insert ( calendarId = calendar_id , body = event ) , callback = handle_request_error ) batch . execute ( )
Inserts events into the Google Calendar
Inserts events into the Google Calendar
""" Inserts events into the Google Calendar """
service
calendar_id
events