Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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 :: tuple count in python 
Python :: python object name 
Python :: Python how to use __mul__ 
Python :: django changing boolean field from view 
Python :: condition python 
Python :: python float range 
Python :: moving element to last position in a list python 
Python :: intersection of three arrays 
Python :: python set 
Python :: .counter python 
Python :: tensorflow neural network 
Python :: download python libraries offline 
Python :: django email 
Python :: beautifulsoup find text inside tag 
Python :: print colors in python 
Python :: link shortener 
Python :: session has key python 3 
Python :: most common letter in string python 
Python :: django generate openapi schema command line 
Python :: transpose of a matrix in python numpy 
Python :: can a function output be save as a variable python 
Python :: python how to add columns to a pandas dataframe 
Python :: promises in python 
Python :: df set index 
Python :: Python how to search in string 
Python :: python linux script 
Python :: python insert item into list 
Python :: pandas count occurrences of certain value in row 
Python :: convert to ascii 
Python :: pytorch get non diag element 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =