Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
BoQsc committed Jul 30, 2024
1 parent 2996555 commit fc0deb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
8 changes: 8 additions & 0 deletions webserver/Webserver/deprecated/getip.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
if self.path == '/Get_WebServer_Public_IP':
self.send_response(200), self.send_header('Content-type', 'text/plain'), self.end_headers()
#import http
#conn = http.client.HTTPSConnection("api.ipify.org")
#conn.request("GET", "/")
#webserver_public_ip = conn.getresponse().read().decode()
#conn.close()
#self.wfile.write(webserver_public_ip.encode('utf-8'))
7 changes: 0 additions & 7 deletions webserver/Webserver/webserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,8 @@ def do_GET(self):
import base64
self.wfile.write(base64.b64decode(favicon_base64))
if self.path == '/Get_WebServer_Public_IP':
#import http
#conn = http.client.HTTPSConnection("api.ipify.org")
#conn.request("GET", "/")
#webserver_public_ip = conn.getresponse().read().decode()
#conn.close()
#self.wfile.write(webserver_public_ip.encode('utf-8'))
self.send_response(200), self.send_header('Content-type', 'text/plain'), self.end_headers()
import urllib.request

webserver_public_ip = urllib.request.urlopen('https://api.ipify.org').read().decode()
self.wfile.write(webserver_public_ip.encode('utf-8'))

Expand Down

0 comments on commit fc0deb9

Please sign in to comment.