mirror of
https://github.com/bvanroll/test-repo.git
synced 2025-09-01 13:32:46 +00:00
Initial import
This commit is contained in:
24
app.py
Normal file
24
app.py
Normal file
@@ -0,0 +1,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')
|
Reference in New Issue
Block a user