Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to make downloadable file in flask

from flask import Flask
from flask import send_file
app = Flask(__name__)

@app.route('/download')
def downloadFile ():
    #For windows you need to use drive name [ex: F:/Example.pdf]
    path = "/Examples.pdf"
    return send_file(path, as_attachment=True)

if __name__ == '__main__':
    app.run(port=5000,debug=True) 
Comment

Flask Download a File

from flask import Flask
from flask import send_file
app = Flask(__name__)

@app.route('/download')
def downloadFile ():
    #For windows you need to use drive name [ex: F:/Example.pdf]
    path = "/Examples.pdf"
    return send_file(path, as_attachment=True)

if __name__ == '__main__':
    app.run(port=5000,debug=True) 
Comment

download files from url in flask

url = 'https://www.facebook.com/favicon.ico'
r = requests.get(url, allow_redirects=True)
Comment

PREVIOUS NEXT
Code Example
Python :: python wget anaconda 
Python :: matplotlib random color 
Python :: how to add subtitle matplotlib 
Python :: python tkinter lable on bottom of screen 
Python :: flask app starter 
Python :: how to move mouse with pyautogui 
Python :: Import "django.core.urlresolvers" could not be resolved 
Python :: bubble sort python 
Python :: python selenium itemprop 
Python :: no such table: django_session 
Python :: python afficher hello world 
Python :: neural network without training return same output with random weight 
Python :: pandas et numeric columns 
Python :: pandas remove prefix from columns 
Python :: find record in mongodb with mongodb object id python 
Python :: create zero array in python 
Python :: Python program that takes 2 words as input from the user and prints out a list containing the letters that the 2 words have in common 
Python :: place a widget in tkinter 
Python :: how to show process bar in terminal python 
Python :: resource wordnet not found python 
Python :: DataFrame.plot.line() method: | dataframe line plot 
Python :: python sqlalchemy engine 
Python :: gdscript top-down 2d movement 
Python :: aioschedule python 
Python :: get package share vs Find Package Share 
Python :: print bold text python 
Python :: python test if value is np.nan 
Python :: lru cache python 
Python :: virtual env in python 
Python :: absolute value of int python 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =