I am experimenting with Bottle and HTML to test HTTP GET and POST. I have written this code which requires user to enter a color name as parameter and if it is present in the pre defined list then it should print found and display the color. But I donot know how do I pass the argument. If I try default values like Orange, Red etc it works fine.
from bottle import*
import socket
@error(404)
def error404(error):
return '<p align=center><b>Sorry, a screw just dropped.Well, we are hoping to find it soon.</b></p>'
@get('/New/rem_serv/:arg')
def nextstep(arg):
_colorlist=['Red','Green','Blue','Yellow','Orange','Black','White']
if arg in _colorlist:
return "Found the same color \n","<p style='font-weight:bold; text-align:center; background-color:arg;'>" + str(arg)
else:
return error404(404)
addrIp = socket.getaddrinfo(socket.gethostname(), None)
addrIp = addrIp[0][4][0]
run(host=addrIp, port=80)
What you are looking for is HTML and CSS.
Use template to make pages.