1+ from http .server import HTTPServer , BaseHTTPRequestHandler
2+ import codecs , time
3+
4+
5+ class Server (BaseHTTPRequestHandler ):
6+ def do_GET (self ):
7+ if self .path == '/' :
8+ self .path = '/index.html' , "/nicepage.css" , "/nicepage.js" , "/jquery.js" , "/glavn.html" , "/glavn.css" , "/images/photo.png" , "/photo.png"
9+ try :
10+ file_to_open = codecs .open (self .path [1 :], "r" , "UTF-8" ).read ()
11+ self .send_response (200 )
12+ try :
13+ self .end_headers ()
14+ self .wfile .write (bytes (file_to_open , "UTF-8" ))
15+ except AttributeError :
16+ pass
17+ except UnicodeDecodeError :
18+ pass
19+ except UnboundLocalError :
20+ pass
21+ except :
22+ file_to_open = "File not found"
23+ self .send_response (404 )
24+ def siteFunc ():
25+ host = "192.168.0.106"
26+ print ("---------------------------INSTRUCTIONS---------------------------\n " +
27+ "How to find out ipv4? - Open a command line \n and then write ipconfig then look for the ipv4 entry of your network!\n " +
28+ "The server does not start! Open port 55555 on your router! \n Google how to do it!\n " +
29+ "Then this application will do everything for you!\n Provided that you download all the necessary libraries!\n " +
30+ "---------------------------INSTRUCTIONS---------------------------\n " )
31+ host = input ("ENTER THE IPv4 ADDRESS OF YOUR COMPUTER:" )
32+ httpd = HTTPServer ((host , 55555 ), Server )
33+ print ("" +
34+ " ____ _____ ______ _______ ____ ____ _____ _ ____ _____ _____ ____ \n " +
35+ " / ___|| ____| _ \ \ / / ____| _ \ / ___|_ _|/ \ | _ \_ _| ____| _ \ \n " +
36+ " \___ \| _| | |_) \ \ / /| _| | |_) | \___ \ | | / _ \ | |_) || | | _| | | | | \n " +
37+ " ___) | |___| _ < \ V / | |___| _ < ___) || |/ ___ \| _ < | | | |___| |_| | \n " +
38+ " |____/|_____|_| \_\ \_/ |_____|_| \_\ |____/ |_/_/ \_\_| \_\|_| |_____|____/ \n " +
39+ "\n " +
40+ " PYTHON HTTP HOSTING SERVER >>> by srgwrtg0342"
41+ )
42+ print ("LOGS>>>>" )
43+ time .sleep (0.09 )
44+ print ("INFO: MEMORY ALLOCATION" )
45+ print ("INFO: PRE-INITIALIZATION CODE VERIFICATION" )
46+ print ("INFO: INITIALIZATION OF CODE CHECK" )
47+ print ("INFO: SUCCESSFUL CODE VERIFICATION" )
48+ print ("INFO: BINDER INITIALIZATION" )
49+ print ("INFO: PRE-INITIALIZING PREPARATION FOR LAUNCHING THE SERVER" )
50+ time .sleep (0.2 )
51+ print ("INFO: PRE-INITIALIZING ERROR CORRECTION" )
52+ print ("INFO: ERROR REPORTING" )
53+ print ("INFO: SOLUTION OF ERRORS ACCORDING TO THE REPORT" )
54+ time .sleep (0.1 )
55+ print ("INFO: INSTALLING PRE-INITIALIZATION RESOURCES" )
56+ print ("INFO: MORE MEMORY ALLOCATION" )
57+ print ("INFO: OPTIMIZED USE" )
58+ print ("INFO: COMPLETION OF THE APP BUILDING - NEXT SERVER" )
59+ time .sleep (0.05 )
60+ print ("INFO: SERVER PRE-INITIALIZATION" )
61+ print ("INFO: INITIALIZATION PREPARATION" )
62+ print ("INFO: INITIALIZING EXTENSIONS" )
63+ print ("INFO: INITIALIZING THE KERNEL" )
64+ time .sleep (0.1 )
65+ print ("INFO: PREPARATION FOR INSTALLATION" )
66+ print ("INFO: INSTALLING HTML" )
67+ print ("INFO: INSTALLING CSS" )
68+ time .sleep (0.25 )
69+ print ("INFO: INSTALLING JS" )
70+ print ("INFO: INITIALIZING THE SERVER CORE" )
71+ print ("INFO: SERVER INITIALIZATION" )
72+ time .sleep (0.1 )
73+ print ("INFO: PRE-BIND SERVER" )
74+ print ("INFO: SERVER BINDING..." )
75+ print ("INFO: SERVER BINDED!" )
76+ time .sleep (0.1 )
77+ print ("Http server on - http://" ,host ,":55555/index.html (url without spaces)" )
78+ httpd .serve_forever ()
79+
80+ siteFunc ()
0 commit comments