Im trying to list a folder of pdf files in html page so that user can download them. I'm able to do this for a single file, but not sure on how to do for a folder. :(
My view is :
def plot_graph_single_fsn(request):
payload = {"fsns": "values",
"signals": "signals",
"responseFormat": "csv"
}
response_data = requests.post(post_api, data=json.dumps(payload))
# Writing response to csv file
temp_file_name = 'temp_csv.csv'
with open(temp_file_name, 'w') as temp_file:
temp_file.writelines(response_data.content.decode('utf-8'))
# calling script that generated pdf folder from csv
csv_file = os.path.abspath('tmp.csv')
util_path = os.getcwd()
process = subprocess.Popen(['python', util_path + '/Utils/' + 'tmp.py', csv_file],
stdout=subprocess.PIPE)
a, err = process.communicate()
print "\n"
return HttpResponse(folder_path)