-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
44 lines (40 loc) · 734 Bytes
/
server.py
File metadata and controls
44 lines (40 loc) · 734 Bytes
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -*- coding:utf-8 -*-
## MorSchedule HTTP Server
##
__author__ = 'MorHop'
__version__ = '2016090609'
##
##
import web
from MorSchedule import get_ics
urls = (
'/', 'Hello',
'/ics', 'Ics',
)
app = web.application(urls, globals())
class Hello:
def GET(self):
return """
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
MorSchedule<br>
重邮 iCalendar 课表接口<br>
<br>
author : MorHop<br>
issues : github.com/Pohrom/MorSchedule/issues<br>
usage : /ics?xh=<br>
</body>
</html>
"""
class Ics:
def GET(self):
i = web.input(xh = None)
if i.xh == None:
return "Usage: /ics?xh="
else:
return get_ics(i.xh)
if __name__ == "__main__":
app.run()