Question: NEED HELP!!! DON'T UNDERSTAND WHAT I'M BEING ASKED TO DO AT THIS POINT To process the form, define a new function encrypt in main.py. Add
NEED HELP!!!
DON'T UNDERSTAND WHAT I'M BEING ASKED TO DO AT THIS POINT
To process the form, define a new function encrypt in main.py. Add an @app.route decorator to configure the function to receive requests at the root path "/", and with methods=['POST'].
When the form is submitted, the request will contain the parameters rot and text. In order to access these, we need Flask's request object. To import it, modify the topmost import statement to include this object.
from flask import Flask, request
Within encrypt, store the values of these request parameters in local variables, converting data types as necessary. Then, encrypt the value of the text parameter using rotate_string. Return the encrypted string wrapped in
tags, to be rendered in the browser.
MY CODE SO FAR
from flask import Flask, request
from caesar import rotate_string
app = Flask(__name__)
app.config['DEBUG'] = True
form= """
form {
background-color: #eee;
padding: 20px;
margin: 0 auto;
width: 540px;
font: 16px sans-serif;
border-radius: 10px;
}
textarea {
margin: 10px 0;
width: 540px;
height: 120px;
}
"""
@app.route("/")
def index():
return form
app.run()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
