Skip to content

Instantly share code, notes, and snippets.

@eyenx
Created February 3, 2014 10:24
Show Gist options
  • Select an option

  • Save eyenx/8781537 to your computer and use it in GitHub Desktop.

Select an option

Save eyenx/8781537 to your computer and use it in GitHub Desktop.
#!/usr/bin/python
import urllib.request as ur
import http.server as hs
import socketserver as ss
import os
indexfile="https://paste.eyenx.ch/index.php/W2AGE"
tmpdir="/tmp/schwaul/"
tmpfile="index.html"
try:
os.mkdir(tmpdir)
except OSError:
pass
r=ur.urlopen(indexfile)
o=r.read().decode('utf-8')
f=open(tmpdir+tmpfile,'w')
f.write(o)
f.close()
os.chdir(tmpdir)
handle=hs.SimpleHTTPRequestHandler
httpd = ss.TCPServer(("",8000),handle)
httpd.serve_forever()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment