How to set proxy while using urllib3.PoolManager in python
<p>I am currently using connection pool provided by urllib3 in python like the following,</p>

<pre><code>pool = urllib3.PoolManager(maxsize = 10)
resp = pool.request('GET', 'http://example.com')
content = resp.read()
resp.release_conn()
</code></pre>

<p>However, I don't know how to set proxy while using this connection pool. I tried to set proxy in the 'request' like <code>pool.request('GET', 'http://example.com', proxies={'http': '123.123.123.123:8888'}</code> but it didn't work.</p>

<p>Can someone tell me how to set the proxy while using connection pool</p>

<p>Thanks~</p>

<p>There is an example for how to use a proxy with urllib3 in the <a href="https://urllib3.readthedocs.io/en/latest/advanced-usage.html#proxies" rel="nofollow">Advanced Usage section of the documentation</a>. I adapted it to fit your example:</p>

<pre><code>import urllib3
proxy = urllib3.ProxyManager('http://123.123.123.123:8888/', maxsize=10)
resp = proxy.request('GET', 'http://example.com/')
content = resp.read()
# You don't actually need to release_conn() if you're reading the full response.
# This will be a harmless no-op:
resp.release_conn()
</code></pre>

<p>The <code>ProxyManager</code> behaves the same way as a <code>PoolManager</code> would.</p>

python proxy connection-pooling urllib3