"""
Download the file at url to target using Powershell (which will validate
trust). Raise an exception if the command cannot complete.
"""
target = os.path.abspath(target)
cmd = ['powershell', '-Command', 
    '[System.Net.WebRequest]::DefaultWebProxy.Credentials = [System.Net.CredentialCache]::DefaultCredentials;  (new-object System.Net.WebClient).DownloadFile(%(url)r, %(target)r)'
     % vars()]
subprocess.check_call(cmd)
Installing Python's easy_install using ez_setup.py from behind a proxy server