def post_index():
event_type = request.get_header('X-GitHub-Event')
if not is_request_from_github():
abort(403, "Forbidden for IP %s, it's not GitHub's address" % remote_ip())
if request.content_type.split(';')[0] != 'application/json':
abort(415, "Expected application/json, but got %s" % request.content_type)
if event_type == 'ping':
return handle_ping()
elif event_type == 'push':
return handle_push()
else:
abort(400, "Unsupported event type: %s" % event_type)
评论列表
文章目录