Created
April 15, 2016 17:54
-
-
Save BrunoCaimar/cdb960f1ed0b6cb1d398c84337b4dda9 to your computer and use it in GitHub Desktop.
Python - Set Proxy via Environment Variables
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def set_proxy_environment_variables(): | |
proxies = urllib.getproxies() | |
http_proxy = proxies.get('http') | |
https_proxy = proxies.get('https') | |
Utils.logs("Proxies: {0}".format(proxies)) | |
if http_proxy is not None and http_proxy != "": | |
Utils.logs("Configurando http proxy: {0}".format(http_proxy)) | |
os.environ["HTTP_PROXY"] = http_proxy | |
if https_proxy is not None and https_proxy != "": | |
Utils.logs("Configurando https proxy: {0}".format(https_proxy)) | |
os.environ["HTTPS_PROXY"] = https_proxy |
It must be
urllib.request.getproxies()
module 'urllib' has no attribute 'getproxies'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
module 'urllib' has no attribute 'getproxies'