E
E
Erix Rolex2019-10-26 17:03:17
Python
Erix Rolex, 2019-10-26 17:03:17

How to respond to a request in Python Flask by giving File.txt from a string with text?

Now I have a piece of code that responds with the text Hello world!
@app.route('/text', methods=['POST'])
def caption():
return 'Hello world!'
How to make the browser receive a File.txt file in response with the text Hello world! ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pcdesign, 2019-10-26
@Erixx

Use send_file
https://pythonise.com/feed/flask/sending-files-wit...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question