Skip to content

Commit 9e7a472

Browse files
author
NimaQu
committed
webapi 对接时碰到错误页面继续运行不关闭端口 by老虎兔儿 & glzjin 给的思路
1 parent 9429acf commit 9e7a472

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

webapi_utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ def getApi(self, uri, params={}):
2626
except Exception:
2727
if res:
2828
logging.error("Error data:%s" % (res.text))
29-
return []
29+
raise Exception('error data!')
3030
if data['ret'] == 0:
3131
logging.error("Error data:%s" % (res.text))
3232
logging.error("request %s error!wrong ret!"%(uri))
33-
return []
33+
raise Exception('wrong ret!')
3434
return data['data']
3535
except Exception:
3636
import traceback
@@ -56,11 +56,11 @@ def postApi(self, uri, params={}, raw_data={}):
5656
except Exception:
5757
if res:
5858
logging.error("Error data:%s" % (res.text))
59-
return []
59+
raise Exception('error data!')
6060
if data['ret'] == 0:
6161
logging.error("Error data:%s" % (res.text))
6262
logging.error("request %s error!wrong ret!"%(uri))
63-
return []
63+
raise Exception('wrong ret!')
6464
return data['data']
6565
except Exception:
6666
import traceback

0 commit comments

Comments
 (0)