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()
评论列表
文章目录