Mar-01-2018, 06:56 PM
(This post was last modified: Mar-01-2018, 08:39 PM by sparkz_alot.)
Hello, so I'm using Python 3.4 and currently I'm trying to get this code that I found to work. So what I want to do is log some information / access it from another location. So this is the code that I'm currently using:
#!/usr/bin/python3.4
import socketserver
import http.server
class HTTPHandler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == "/admin":
self.wfile.write("This Page is For Admins Only!!\n")
self.wfile.write(self.headers)
else:
http.server.SimpleHTTPRequestHandler.do_GET(self)
http_Server = socketserver.TCPServer((" ", 4444), HTTPHandler)
http_Server.server_forever()
But it gives me this error:
socket.gaierror: [Errno -2] Name or Service not known
Can someone explain to me what this error means and how I can fix this issue?
Thanks
#!/usr/bin/python3.4
import socketserver
import http.server
class HTTPHandler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == "/admin":
self.wfile.write("This Page is For Admins Only!!\n")
self.wfile.write(self.headers)
else:
http.server.SimpleHTTPRequestHandler.do_GET(self)
http_Server = socketserver.TCPServer((" ", 4444), HTTPHandler)
http_Server.server_forever()
But it gives me this error:
socket.gaierror: [Errno -2] Name or Service not known
Can someone explain to me what this error means and how I can fix this issue?
Thanks
