-
-
Save wwqgtxx/4576439 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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