Changeset 143:2c1b6b6e6cac

Show
Ignore:
Timestamp:
11/09/08 03:28:23 (3 years ago)
Author:
chris
Branch:
unix
Message:

add ability to auth against the proxy

Files:
1 removed
1 modified

Legend:

Unmodified
Added
Removed
  • StormSiren/XmlWeather.py

    r142 r143  
    4242""" 
    4343 
    44 import urllib 
     44import urllib2 
    4545import logging 
    4646import sys 
     
    7979                                self.__dom = minidom.parse("examples/" + self.__state.lower() + ".cap") 
    8080                        else: 
    81                                 proxy = None 
    8281                                if(self.__proxy): 
    8382                                        self.log.info("Using proxy: %s" % self.__proxy) 
    84                                         proxy = { 'http' : self.__proxy } 
    85                                 self.__dom = minidom.parse(urllib.urlopen(self.__url, proxies = proxy)) 
     83                                        proxy_support = urllib2.ProxyHandler({"http" : self.__proxy}) 
     84                                        opener = urllib2.build_opener(proxy_support, urllib2.HTTPHandler) 
     85                                        urllib2.install_opener(opener) 
     86                                self.__dom = minidom.parse(urllib2.urlopen(self.__url)) 
    8687                except IOError,e: 
    8788                        # No net connection available, exit.