import selenium
import urllib.request, urllib.error, urllib.parse
from contextlib import contextmanager

@contextmanager
def no_proxies():
    orig_getproxies = urllib2.getproxies
urllib2.getproxies = lambda : {}
yield
urllib2.getproxies = orig_getproxies
with no_proxies():
    driver = selenium.webdriver.Ie()
driver.get('http://google.com')
Python: Disable http_proxy in urllib2