Work-around for setting conda proxy User-Agent

Cuong Tran
Aug 3, 2021

--

In many enterprises, network security rules are very strict, and it is often need to use some proxies to be able to download Python packages via conda or pip. How to do the proxy settings for those tools are easily searched by using Google Search.

The setting is easy but some security policy require proxy server to check for a specific User-Agent patterns in addition to proxy authentication information. And the problem is there is no instruction for setting custom User-Agent via setting file or input parameters.

A work-around is to modify the conda source file session.py and hard-code the User-Agent setting in class CondaSession(Session) as following:

(The full path of the file is something like this Anaconda3\Lib\site-packages\conda\gateways\connection\session.py in Windows.)

--

--