-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.py
34 lines (24 loc) · 783 Bytes
/
web.py
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# ,--(saket)--(RiPlayServer)--(02/08/16 12:23)--(【ツ】)---
# `--(~/web.py$)-->
from shutil import copyfileobj
__tag__ = 'web'
def handler(request):
url = request.path
if url == "/":
request.send_response(200)
request.send_header('Content-Type', 'text/html')
request.end_headers()
fav = file("webpage.html")
copyfileobj(fav, request.wfile)
fav.close()
elif url == "/favicon.ico":
request.send_response(200)
request.send_header('Content-Type', 'image/png')
request.end_headers()
fav = file("favicon.png")
copyfileobj(fav, request.wfile)
fav.close()
else:
request.send_error(404, "Not found %r" % url)