Biodata Form
{% if short_url %}Your short link: {{ short_url }}
{% endif %} """ @app.route("/", methods=["GET", "POST"]) def index(): short_url = None if request.method == "POST": name = request.form["name"] age = request.form["age"] skills = request.form["skills"] code = generate_short_code() bio_data_storage[code] = {"name": name, "age": age, "skills": skills} short_url = request.host_url + code return render_template_string(form_html, short_url=short_url) @app.route("/")
def show_biodata(code):
data = bio_data_storage.get(code)
if data:
return f"{data['name']}'s Biodata
Age: {data['age']}
Skills: {data['skills']}
"
return "Link not found
", 404
if __name__ == "__main__":
app.run(debug=True)
No comments:
Post a Comment