import requests
dest_name = "dest.xlsx"
dest_file_path = os.path.join(sql_file_dir, dest_name)
url = 'http://testurl/api/export_file' # as an example
urlData = requests.post(url).content # Get the content from the url
with open(dest_file_path, 'wb') as f:
f.write(urlData)
注:如果输出的是xlsx文件open文件时用的模式一定要是wb的,用a的会失败



