datadb-scripts/test

26 lines
553 B
Plaintext
Raw Permalink Normal View History

2015-12-26 21:38:18 -08:00
#!/usr/bin/env python3
import os
from urllib.parse import parse_qs
2017-05-27 12:08:31 -07:00
2015-12-26 21:38:18 -08:00
def start_response(content_type="text/html", status_code=("200", "OK",)):
print('Status: %s %s' % (status_code))
print("Content-Type: %s" % content_type)
print()
2017-05-27 12:08:31 -07:00
2015-12-26 21:38:18 -08:00
if __name__ == "__main__":
try:
2017-05-27 12:08:31 -07:00
2015-12-26 21:38:18 -08:00
data = parse_qs(os.environ["QUERY_STRING"])
2017-05-27 12:08:31 -07:00
2015-12-26 21:38:18 -08:00
assert "yo" in data
2017-05-27 12:08:31 -07:00
2015-12-26 21:38:18 -08:00
start_response()
print("you passed: ?yo=%s" % data["yo"][0])
2017-05-27 12:08:31 -07:00
2015-12-26 21:38:18 -08:00
except Exception as e:
start_response(status_code=('500', "you fucked up"))
print(str(e))