Advertisement
Guest User

Untitled

a guest
Feb 14th, 2020
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.54 KB | None | 0 0
  1. from netcreds import *
  2. from nettools import *
  3. import usocket as socket
  4.  
  5. wlan_connect(essid,essid_password)
  6.  
  7.  
  8. def web_page():
  9.  
  10.  
  11.   html = """
  12.  <!DOCTYPE html>
  13. <html>
  14. <head>
  15.     <title>AUTOAGILITY &copy</title>
  16.     <link rel="stylesheet" type="text/css" href="style.css">
  17. </head>
  18. <body>
  19.     <div id="container">
  20.         <div id="header">
  21.             <h2>AUTOAGILITY</h2>   
  22.         </div>
  23.         <div id= "instruct">
  24.             <p>PRESS A BUTTON TO SET THE HEIGHT</p>
  25.         </div>
  26.         <div class="radio-toolbar">
  27.             <input type="radio" id="five" name="height" value="5">
  28.             <label for="five">500</label>  </br>
  29.             <input type="radio" id="four" name="height" value="4">
  30.             <label for="four">400</label> </br>
  31.             <input type="radio" id="three" name="height" value="3">
  32.             <label for="three">300</label> </br>
  33.             <input type="radio"id="two" name="height" value="2">
  34.             <label for="two">200</label> </br>
  35.             <input type="radio" id="one" name="height" value="1" checked>
  36.             <label for="one">100</label>
  37.             <p></p>
  38.         </div>
  39.         <div id="footer">
  40.                 Copyright &copy; 2019 Autoagility
  41.         </div>
  42.     </div>
  43.  
  44. </body>
  45. </html>
  46.  """
  47.   return html
  48.  
  49. s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  50. s.bind(('', 80))
  51. s.listen(5)
  52.  
  53. while True:
  54.   conn, addr = s.accept()
  55.   print('Got a connection from %s' % str(addr))
  56.   request = conn.recv(1024)
  57.   request = str(request)
  58.   print('Content = %s' % request)
  59.   response = web_page()
  60.   conn.send('HTTP/1.1 200 OK\n')
  61.   conn.send('Content-Type: text/html\n')
  62.   conn.send('Connection: close\n\n')
  63.   conn.sendall(response)
  64.   conn.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement