Пример #1
0
def register_events(context, cli, session):
    credentials = google.oauth2.credentials.Credentials(**session.credentials)
    Session.update_session(cli.id, credentials)
    calendar_service = __start_service('calendar', 'v3', credentials)   
    
    event = CalendarMB.generate_event(context)
    CalendarAPI.regist_event(calendar_service, event)   
    FacebookAPI.send_message(cli.id, 'The event is registered =D')               # register the above event example
    Client.end_context(cli.id)                 
Пример #2
0
def list_events(context, cli, session):
    credentials = google.oauth2.credentials.Credentials(**session.credentials)
    Session.update_session(cli.id, credentials)
    calendar_service = __start_service('calendar', 'v3', credentials)        
    
    if context['number'] is not None:
        events = CalendarAPI.list_events(calendar_service, int(context['number'])) 
    else:
        events = CalendarAPI.list_events(calendar_service, 3)         
    elements = CalendarMB.list_events(events)
    FacebookAPI.send_carousel(cli.id, elements)  
    Client.end_context(cli.id)