gcal_sync.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:hashtagtodo-open 作者: slackpad 项目源码 文件源码
def get_todolist(user, client):
    # Try the primary calendar first, as this is the default for the
    # vast majority of users.
    default = client.calendars().get(calendarId='primary').execute()
    event = _get_todolist(user, client, default)
    if event is not None:
        return event, default

    # Now look at the user's other calendars to see if it's on there.
    calendars = client.calendarList().list().execute()
    for calendar in calendars.get('items', ()):
        if calendar['id'] == default['id']:
            continue

        if not calendar['accessRole'] in ('owner', 'writer'):
            continue

        event = _get_todolist(user, client, calendar)
        if event is not None:
            return event, calendar

    # They don't have one, so add it to their default calendar.
    return None, default
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号