🏗️」 wip: post kinda working

This commit is contained in:
2025-05-29 11:51:40 +02:00
parent e8261b0d97
commit 43ac0792c0
11 changed files with 133 additions and 69 deletions

30
exemples/webpage/test.py Executable file
View File

@ -0,0 +1,30 @@
#!/nix/store/kjvgj2n3yn70hmjifg6y0bk9m4rf7jba-python3-3.12.10/bin/python3
import cgi
import cgitb
# Enable error reporting
cgitb.enable()
print("Content-Type: text/html") # HTML is following
print() # blank line, end of headers
form = cgi.FieldStorage()
# Get data from fields
name = form.getvalue("name")
email = form.getvalue("email")
print(f"""
<!DOCTYPE html>
<html>
<head>
<title>POST Request Received</title>
</head>
<body>
<h1>POST Request Received</h1>
<p>Name: {name}</p>
<p>Email: {email}</p>
</body>
</html>
""")