I am looking at a package (which can be installed using pip) code which requires a file from internet.
Pip provides an option to mention proxy details as shown below
pip install --proxy="http://user:pass@proxyserver:port" package_name
But the same proxy details are not identified by the setup.py script of the package. When I modified the setup.py file using the following lines, it works fine.
proxy_url = 'http://user:pass@proxy:port/'
proxy_url_https = 'http://user:pass@proxy:port/'
proxy_handler = urllib2.ProxyHandler({'http': proxy_url, 'https': proxy_url_https})
opener = urllib2.build_opener(proxy_handler, urllib2.HTTPHandler)
urllib2.install_opener(opener)
But how can the setup.py file be modified to check if the proxy is provided and take the necessary steps?