Commit 9867575e by 岳巧源

modify script

parent 63ec1cee
Showing with 4 additions and 1 deletions
......@@ -99,21 +99,24 @@ def resolve(file_name: str, supplier_id: int):
table["ladder_price"].append(item_map)
ans = json.dumps(table, ensure_ascii=False)
producer.push(ans)
os.remove(file_name)
producer.close()
def process(url: str, supplier_id: int):
# http://erp.liexindev.net/sku/20240823/p6jMKaPtjMpNnZMK5vEX3KEQf7Gdvgvw3TCA7d6b.xls
abs_path = ""
try:
response = requests.get(url)
if response.status_code == 200:
tmp_file = url.split(sep="/")[-1]
absolute_path = config.tmp_xls_file_dir + tmp_file
abs_path = absolute_path
with open(absolute_path, "wb") as f:
f.write(response.content)
resolve(absolute_path, supplier_id)
except Exception as e:
print(e)
finally:
os.remove(abs_path)
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 sign in to comment