Files
PiClock/web_tools.py
2024-01-03 09:59:59 +01:00

9 lines
406 B
Python

def result_ok(cl, response = None, content_type = "text/plain"):
cl.send('HTTP/1.0 200 OK\r\nContent-type: ' + content_type + '\r\n\r\n')
cl.send(response if response is not None else "Ok")
cl.close()
def result_notfound(cl, response = None):
cl.send('HTTP/1.0 404 NotFound\r\nContent-type: text/plain\r\n\r\n')
cl.send(response if response is not None else "Not Found")
cl.close()