Skip to content

Instantly share code, notes, and snippets.

@wwqgtxx
Forked from phoenixxie0/gist:4524266
Last active December 11, 2015 08:58
Show Gist options
  • Save wwqgtxx/4576439 to your computer and use it in GitHub Desktop.
Save wwqgtxx/4576439 to your computer and use it in GitHub Desktop.
import urllib2
from zipfile import *
import zipfile
import os
def download(url):
# Install proxy support for urllib2
proxy_handler = urllib2.ProxyHandler({"https" : "http://127.0.0.1:8087"})
opener = urllib2.build_opener(proxy_handler)
urllib2.install_opener(opener)
# List the content of a directory (it returns an HTML page built by the proxy)
# (You will have to parse the HTML to extract the list of files and directories.)
#print urllib2.urlopen("https://nodeload.github.com/goagent/goagent/legacy.zip/2.0").read()
# Download a file:
data = urllib2.urlopen(url).read()
open("master.zip","w+b").write(data)
x = zipfile.ZipFile("master.zip")
x.extractall()
x.close()
if os.path.isfile('master.zip'):
os.remove('master.zip')
download('https://nodeload.github.com/goagent/goagent/legacy.zip/2.0')
download('https://github.com/wallproxy/wallproxy/zipball/win')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment