Skip to content

Instantly share code, notes, and snippets.

@Steve132
Created December 4, 2015 20:53
Show Gist options
  • Save Steve132/e4c6a335a0956a1b573b to your computer and use it in GitHub Desktop.
Save Steve132/e4c6a335a0956a1b573b to your computer and use it in GitHub Desktop.
Python server download
import SimpleHTTPServer
import SocketServer
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("gmail.com",80))
IP=s.getsockname()[0]
s.close()
PORT = 8000
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", PORT), Handler)
print("Now sharing files at http://%s:%d/" % (IP,PORT))
print("Press Ctrl-C in this window to stop sharing files.")
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment