summaryrefslogtreecommitdiff
path: root/cgi-bin/sleep.cgi
blob: 87c017cc9db084e9ae28163c0bcc749115a6e3fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python3

import cgi
import cgitb
import os
import time

cgitb.enable()

qs = cgi.parse_qs(os.getenv("QUERY_STRING", "t=10&ct=text/javascript"))

content_type = qs.get("ct", ["text/javascript"])[0]

if content_type == "text/javascript":
    prefix = "// "
else:
    prefix = ""

print("Content-Type: {}".format(content_type))
print("")

sleep_time = int(qs.get("t", [10])[0])

print("{}Sleeping for {} seconds".format(prefix, sleep_time))

time.sleep(sleep_time)

print("{}Done sleeping {} seconds".format(prefix,sleep_time))