这是代码。它可以在localhost上运行,并下载保存app.py的文件。
import requests
app = flask(__name__)
@app.route('/')
def hello():
return '<h1>Hello World!</h1>'
@app.route('/download')
def download():
download_url = "https://www.python.org/static/community_logos/python-logo-master-v3-TM.png"
r = requests.get(download_url)
with open("python_logo.png",'wb') as f:
f.write(r.content)
return "<h2>Download Complete<h2>"
if __name__ == "__main__":
app.run()
我不想使用S3上传文件,因为文件大小为2-3 MB,并且我不想花在S3上。