blob: c0b40a546d72b7b015e055f51a16c0292ec1799c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/usr/bin/env python3
from georgedata import george
order = list(george.keys())
from os import getenv
from urllib.parse import parse_qs
qs = getenv("QUERY_STRING")
query = parse_qs(qs)
try:
member = query["from"][0]
dir = query["dir"][0]
ind = order.index(member)
offs = {"next":1,"prev":-1}[dir]
except (ValueError,KeyError):
print("Status: 400")
print("Content-Type: text/html")
print()
print("<h1 style=\"color:red\">bad request</h1>")
else:
l=len(order)
m = george[order[(ind+offs)%l]]
print("Location: "+m)
|