<p dir="auto">Using a session object and setting the proxies dictionary does not affect the proxies used during a request.</p>
<p dir="auto">ex: Still tries to use system proxy.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="s = requests.Session()
s.proxies = {'http': None, 'https': None}
s.post(url='http://10.0.1.1', json={'test': 'data'})"><pre class="notranslate"><code class="notranslate">s = requests.Session()
s.proxies = {'http': None, 'https': None}
s.post(url='http://10.0.1.1', json={'test': 'data'})
</code></pre></div>
<p dir="auto">Using proxies during each request works, but it would be great to set them at the session level. Specifically if you potentially have dozens or ".post()" or ".get()" calls throughout your script.</p>
<p dir="auto">Any thoughts?</p>
<p dir="auto"><code class="notranslate">Session.trust_env = False</code> turns off the checking of environment variables for options including proxy settings (<code class="notranslate">*_proxy</code>). But <code class="notranslate">urllib</code> picks up and uses these environment proxy settings anyway. <code class="notranslate">requests</code> should pass the <code class="notranslate">trust_env</code> setting on to <code class="notranslate">urllib</code>. (Although I'm not sure if <code class="notranslate">urllib</code> has a similar override.)</p>
<p dir="auto">(Proxy setting precedence should be sorted out here as well. They way it is now, environment proxy settings will interfere with (rather than be over-ridden by) the <code class="notranslate">proxies</code> argument in <code class="notranslate">Session.request</code> or <code class="notranslate">requests.request</code> calls and the <code class="notranslate">Session.proxies</code> config regardless of <code class="notranslate">trust_env</code> settings.)</p>