💾 Archived View for 80h.dev › projects › gemserv › files › cgi-scripts › scgi › scgi.py.gemini captured on 2020-09-24 at 00:58:23. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2020-09-24)
-=-=-=-=-=-=-
01 #! /usr/local/bin/python3.6
02 import scgi
03 import scgi.scgi_server
04
05 class TimeHandler(scgi.scgi_server.SCGIHandler):
06 def produce(self, env, bodysize, input, output):
07 header = "20\ttext/gemini\r\n"
08 hi = "python\n"
09 output.write(header.encode())
10 output.write(hi.encode())
11
12 # Main program: create an SCGIServer object to
13 # listen on port 4000. We tell the SCGIServer the
14 # handler class that implements our application.
15 server = scgi.scgi_server.SCGIServer(
16 handler_class=TimeHandler,
17 port=4000
18 )
19 # Tell our SCGIServer to start servicing requests.
20 # This loops forever.
21 server.serve()