寻息接口优化
This commit is contained in:
parent
b38b76ef81
commit
6f78d5dc0a
|
@ -95,7 +95,7 @@ class XxCommonViewSet(CreateModelMixin, CustomGenericViewSet):
|
||||||
url=vdata['url'],
|
url=vdata['url'],
|
||||||
method=vdata.get('method', 'post'),
|
method=vdata.get('method', 'post'),
|
||||||
params=vdata.get('params', {}),
|
params=vdata.get('params', {}),
|
||||||
json=vdata.get('data', {}))
|
json=vdata.get('json', {}))
|
||||||
return Response(res)
|
return Response(res)
|
||||||
|
|
||||||
@action(methods=['get'], detail=False, permission_classes=[IsAuthenticated])
|
@action(methods=['get'], detail=False, permission_classes=[IsAuthenticated])
|
||||||
|
@ -128,7 +128,7 @@ class DhCommonViewSet(CreateModelMixin, CustomGenericViewSet):
|
||||||
url=vdata['url'],
|
url=vdata['url'],
|
||||||
method=vdata.get('method', 'post'),
|
method=vdata.get('method', 'post'),
|
||||||
params=vdata.get('params', {}),
|
params=vdata.get('params', {}),
|
||||||
json=vdata.get('data', {}))
|
json=vdata.get('json', {}))
|
||||||
return Response(res)
|
return Response(res)
|
||||||
|
|
||||||
@action(methods=['get'], detail=False, permission_classes=[IsAuthenticated])
|
@action(methods=['get'], detail=False, permission_classes=[IsAuthenticated])
|
||||||
|
|
|
@ -74,8 +74,8 @@ class XxClient:
|
||||||
else:
|
else:
|
||||||
r = getattr(requests, method)('{}{}'.format(settings.XX_BASE_URL, url)
|
r = getattr(requests, method)('{}{}'.format(settings.XX_BASE_URL, url)
|
||||||
, params=params, json=json, verify=False)
|
, params=params, json=json, verify=False)
|
||||||
if settings.DEBUG:
|
# if settings.DEBUG:
|
||||||
print_roundtrip(r)
|
# print_roundtrip(r)
|
||||||
ret = r.json()
|
ret = r.json()
|
||||||
if ret.get('errorCode') == '1060000':
|
if ret.get('errorCode') == '1060000':
|
||||||
self.get_token() # 重新获取token
|
self.get_token() # 重新获取token
|
||||||
|
|
Loading…
Reference in New Issue