changeset 5577:c5d81ab00fef

HACK, DO NOT SUBMIT: add glasgow web proxy
author Graham Percival <gperciva@gperciva-desktop.(none)>
date Mon, 14 Sep 2009 11:33:47 +0100
parents 72f8f8091b03
children c2a39f6a2f1e
files gub/misc.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gub/misc.py	Thu Sep 24 09:56:22 2009 +0200
+++ b/gub/misc.py	Mon Sep 14 11:33:47 2009 +0100
@@ -314,6 +314,11 @@
 
 def _download_url (url, dest_dir, progress=None):
     progress ('downloading %(url)s -> %(dest_dir)s\n' % locals ())
+    if (url.startswith ('http:')):
+        proxy = urllib2.ProxyHandler({"http": "http://wwwcache.gla.ac.uk:8080"})
+        opener = urllib2.build_opener(proxy)
+        urllib2.install_opener(opener)
+
     if not os.path.isdir (dest_dir):
         raise Exception ('not a dir', dest_dir)