def verify_slack_token(http_method, allowed_token_list):
token = ''
if http_method == 'GET':
token = request.args.get('token', '')
elif http_method == 'POST':
token = request.values['token']
else:
raise Exception("Error: unsupported http_method(%s)" % (http_method))
if token not in allowed_token_list:
content = "Error: invalid token(%s)" % (token)
raise Exception(content)
return None
评论列表
文章目录