💾 Archived View for tilde.cafe › ~winter › cgi-bin › cat.sh › survey.py captured on 2022-06-03 at 23:13:20.
-=-=-=-=-=-=-
#!/usr/bin/env python3 # Survey CGI script for Gemini import os import sys from urllib.parse import unquote survey = os.environ['PATH_INFO'][1:] if survey == '': print('59 No survey specified\r') sys.exit() if 'QUERY_STRING' not in os.environ: print('10 Enter response\r') sys.exit() response = unquote(os.environ['QUERY_STRING']) with open('result.csv', 'a') as f: f.write(f'{survey},{response}\n') print('20 text/gemini\r') print('Your response has been recorded')