pushes_api.py 文件源码

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

项目:hashtagtodo-open 作者: slackpad 项目源码 文件源码
def calendar_push():
    watch_id = request.headers['X-Goog-Channel-ID']
    db_calendar = Calendar.get_by_watch_id(watch_id)
    if db_calendar:
        if db_calendar.active:
            user = db_calendar.key.parent().get()
            client = make_client(user)
            sync_time = datetime.utcnow()
            try:
                updates = sync_calendar(sync_time, user, client, db_calendar)
                if updates:
                    sync_user(sync_time, user, client)
            except Exception as e:
                print e
    else:
        resource_id = request.headers['X-Goog-Resource-ID']
        print 'Unknown push notification for resource id %s' % resource_id

    return make_response()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号