-
Notifications
You must be signed in to change notification settings - Fork 14
/
app.py
24 lines (18 loc) · 579 Bytes
/
app.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
#!/usr/bin/python
from http.server import BaseHTTPRequestHandler, HTTPServer
PORT_NUMBER = 8080
class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
"""Handler for GET requests"""
self.send_response(200)
self.send_header('Content-type','image/png')
self.end_headers()
with open('logo.png', 'rb') as f:
self.wfile.write(f.read())
try:
server = HTTPServer(('', PORT_NUMBER), MyHandler)
print('Started httpserver on port', PORT_NUMBER)
server.serve_forever()
except KeyboardInterrupt:
server.server_close()
print('Stopping server')