Definition at line 6 of file server.py.
◆ do_GET()
def server.Serv.do_GET |
( |
|
self | ) |
|
Definition at line 7 of file server.py.
10 self.path =
'/index.html' 12 if self.path ==
'/modules_data.json':
13 self.path =
'/modules_data.json' 16 file_path = self.path[1:]
19 with open(file_path,
'rb')
as file:
20 file_to_open = file.read()
23 mime_type, _ = mimetypes.guess_type(file_path)
26 self.send_response(200)
28 self.send_header(
"Content-type", mime_type)
32 self.wfile.
write(file_to_open)
34 except FileNotFoundError:
36 self.send_response(404)
37 self.send_header(
"Content-type",
"text/html")
39 self.wfile.
write(bytes(
"File not found",
'utf-8'))
41 except Exception
as e:
43 self.send_response(500)
44 self.send_header(
"Content-type",
"text/html")
46 self.wfile.
write(bytes(f
"Internal server error: {str(e)}",
'utf-8'))
◆ path