支付接口免验证

parent 7241d682
......@@ -41,8 +41,7 @@ tamp_pay_engine = create_engine(
port=config[env]['MySQL']['port'],
user=config[env]['MySQL']['user'],
password=config[env]['MySQL']['password'],
charset="utf8"),
echo=False
charset="utf8")
)
# redis = redis.StrictRedis(
......
......@@ -66,16 +66,20 @@ def add_errorhandler(app):
token = request.headers.get('tampToken', '')
# token = 'eyJhbHQiOiJIUzI1NiIsImFsZyI6IkhTMjU2IiwidHlwIjoiSldUIn0.eyJwYXlsb2FkIjoidGFtcC8xOTM3NzkzMDc5NzY5NDE1NjgiLCJpc3MiOiJjYWl4aWFvcXVhbiIsImlhdCI6MTYwNjI5MDYzMH0.WnADEiWd27A8wr2DmOyX1kcs0dWLxpoO-k1yiF0qbBk'
url = config[env]['token_auth_url']
print(request.path)
start = time.time()
requests.adapters.DEFAULT_RETRIES = 5 # 增加重连次数
s = requests.session()
s.keep_alive = False
res = s.get(url+'?tampToken='+token)
print('token鉴权时间', time.time() - start)
resp = res.json()
if resp['statusCode'] != "0000":
raise CustomFlaskErr(Errors.TOKEN_INVALID)
request.user_id = resp['attributes']
if request.path in ['/tamp_order/micro_shop/topUpOrderNotify', '/tamp_order/micro_shop/consumeOrderNotify']:
pass
else:
requests.adapters.DEFAULT_RETRIES = 5 # 增加重连次数
s = requests.session()
s.keep_alive = False
res = s.get(url+'?tampToken='+token)
print('token鉴权时间', time.time() - start)
resp = res.json()
if resp['statusCode'] != "0000":
raise CustomFlaskErr(Errors.TOKEN_INVALID)
request.user_id = resp['attributes']
request.return_success = {'statusCode': "0000", 'message': 'ok'}
@app.after_request
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment