Beispiel #1
0
def insert_calendar(service, calendar_id):
    body = {
        'id': calendar_id,
        'foregroundColor':  '#ffffff', # just testing the param stuff
        'backgroundColor':  '#0088aa'
    }
    param = {
        'colorRgbFormat': True # use the foreground and background colors
    }
    created_calendar = service.calendarList().insert(body=body, **param).execute()

if __name__ == "__main__":
    import argparse
    
    parser = argparse.ArgumentParser(description="Manipulate a user's calendars.")
    parser.add_argument('-a', '--authenticate', action='store_true',
                       help='(re-)authenticate via OAuth2')
    parser.add_argument('-c', '--calendar', type=str, help='calendar ID to share to this user')
    parser.add_argument('-u', '--user', type=str, help='email address of user to share calendar with')
    args = parser.parse_args()
    
    if args.authenticate:
        cache.authenticate('https://www.googleapis.com/auth/calendar')
    service = cache.get_service_object('calendar', 'v3')
    if args.calendar:
        if args.user:
            share_calendar(service, args.calendar, args.user)
        else:
            print "Calendar not shared: You must supply a user email address!"
    list_calendars(service)
Beispiel #2
0
            print "anyone in %s - %s" % (client.domain, domain_role)
        if public_role is None and domain_role is None:
            print "site is PRIVATE"
        print "user and group roles:"
        for acl_entry in acl_feed.entry:
            scope = acl_entry.scope
            if str(scope.type) != 'default' and str(scope.type) != 'domain':
                role = acl_entry.role
                if role is not None:
                    role = role.value
                print '    %s (%s) - %s' % (scope.value, scope.type, role)
        print "\n"

if __name__ == "__main__":
    import argparse

    parser = argparse.ArgumentParser(description="List sites information for a domain.")
    parser.add_argument('-a', '--authenticate', action='store_true',
                       help='(re-)authenticate via OAuth2')
    parser.add_argument('-f', '--full', action='store_true', 
                        help='show all sites in domain, not just those shared with user')
    parser.add_argument('domain', help='domain for client')
    args = parser.parse_args()
    
    if args.authenticate:
        cache.authenticate('https://sites.google.com/feeds/')
    
    client = gdata.sites.client.SitesClient(source='sites-manager-v1', site='', domain=args.domain)
    cache.authorize_gdata_client(client)
    list_sites(client, args.full)