|
@@ -47,50 +47,50 @@ def api_webhook_bytedance_messages():
|
|
|
return '200'
|
|
|
|
|
|
|
|
|
-@app.route('/webhook/get_file', methods=['POST'])
|
|
|
-def api_webhook_get_file():
|
|
|
- payload = {}
|
|
|
- headers = {
|
|
|
- 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
|
|
|
- 'Accept': '*/*',
|
|
|
- 'Host': 'api.tjyourong.com.cn',
|
|
|
- 'Connection': 'keep-alive'
|
|
|
- }
|
|
|
-
|
|
|
- if 'file' not in request.files:
|
|
|
- url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='error')
|
|
|
- response = requests.request("GET", url, headers=headers, data=payload)
|
|
|
- print(response.text, 'error1')
|
|
|
- return '200'
|
|
|
- file = request.files['file']
|
|
|
- if file.filename == '':
|
|
|
- url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='error')
|
|
|
- response = requests.request("GET", url, headers=headers, data=payload)
|
|
|
- print(response.text, 'error2')
|
|
|
- return '200'
|
|
|
- try:
|
|
|
- file.save('/home/excel/' + 'upload.csv')
|
|
|
- status = UpLoadFile.uploadFile('upload.csv')
|
|
|
- if status == 0:
|
|
|
- url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='success')
|
|
|
- requests.request("GET", url, headers=headers, data=payload)
|
|
|
- else:
|
|
|
- url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='error')
|
|
|
- requests.request("GET", url, headers=headers, data=payload)
|
|
|
- material_status = EtlFirstDeliveryValidMaterials().handler()
|
|
|
- if material_status == 0:
|
|
|
- url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='success')
|
|
|
- requests.request("GET", url, headers=headers, data=payload)
|
|
|
- else:
|
|
|
- url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='error')
|
|
|
- requests.request("GET", url, headers=headers, data=payload)
|
|
|
- os.remove('/data/excel/' + 'upload.csv')
|
|
|
- return '200'
|
|
|
- except Exception as e:
|
|
|
- url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='error')
|
|
|
- response = requests.request("GET", url, headers=headers, data=payload)
|
|
|
- print(response.text, 'error3')
|
|
|
- return '200'
|
|
|
+# @app.route('/webhook/get_file', methods=['POST'])
|
|
|
+# def api_webhook_get_file():
|
|
|
+# payload = {}
|
|
|
+# headers = {
|
|
|
+# 'User-Agent': 'Apifox/1.0.0 (https://apifox.com)',
|
|
|
+# 'Accept': '*/*',
|
|
|
+# 'Host': 'api.tjyourong.com.cn',
|
|
|
+# 'Connection': 'keep-alive'
|
|
|
+# }
|
|
|
+#
|
|
|
+# if 'file' not in request.files:
|
|
|
+# url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='error')
|
|
|
+# response = requests.request("GET", url, headers=headers, data=payload)
|
|
|
+# print(response.text, 'error1')
|
|
|
+# return '200'
|
|
|
+# file = request.files['file']
|
|
|
+# if file.filename == '':
|
|
|
+# url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='error')
|
|
|
+# response = requests.request("GET", url, headers=headers, data=payload)
|
|
|
+# print(response.text, 'error2')
|
|
|
+# return '200'
|
|
|
+# try:
|
|
|
+# file.save('/home/excel/' + 'upload.csv')
|
|
|
+# status = UpLoadFile.uploadFile('upload.csv')
|
|
|
+# if status == 0:
|
|
|
+# url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='success')
|
|
|
+# requests.request("GET", url, headers=headers, data=payload)
|
|
|
+# else:
|
|
|
+# url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='error')
|
|
|
+# requests.request("GET", url, headers=headers, data=payload)
|
|
|
+# material_status = EtlFirstDeliveryValidMaterials().handler()
|
|
|
+# if material_status == 0:
|
|
|
+# url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='success')
|
|
|
+# requests.request("GET", url, headers=headers, data=payload)
|
|
|
+# else:
|
|
|
+# url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='error')
|
|
|
+# requests.request("GET", url, headers=headers, data=payload)
|
|
|
+# os.remove('/data/excel/' + 'upload.csv')
|
|
|
+# return '200'
|
|
|
+# except Exception as e:
|
|
|
+# url = "http://api.tjyourong.com.cn/jeecg-boot/first/delivery/excelCallBack?msg={msg}".format(msg='error')
|
|
|
+# response = requests.request("GET", url, headers=headers, data=payload)
|
|
|
+# print(response.text, 'error3')
|
|
|
+# return '200'
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|