def __init__(self, user_agent=USER_AGENT): proxies = {} http_proxy = get_http_proxy_string_from_gconf() if http_proxy: proxies = { "http" : http_proxy } urllib.FancyURLopener.__init__(self, proxies) self.version = user_agent
def set_http_proxy(self, trans): """ set http proxy based on gconf and attach it to a transaction """ http_proxy = get_http_proxy_string_from_gconf() if http_proxy: trans.set_http_proxy(http_proxy, reply_handler=lambda t: True, error_handler=self._on_trans_error)