<p dir="auto">Summary.</p>
<h2 dir="auto">Expected Result</h2>
<p dir="auto">i can import exception from requests.</p>
<h2 dir="auto">Actual Result</h2>
<p dir="auto">when i catch LocationValueError, i need import LocationValueError from urllib3.exceptions, not from requests....</p>
<h2 dir="auto">System Information</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ python v2.7.0"><pre class="notranslate"><code class="notranslate">$ python v2.7.0
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;paste here&gt;"><pre class="notranslate"><code class="notranslate">&lt;paste here&gt;
</code></pre></div>
<p dir="auto">This command is only available on Requests v2.16.4 and greater. Otherwise,<br>
please provide some basic information about your system (Python version,<br>
operating system, &amp;c).</p>
<p dir="auto">I am using a 3rd party library that uses requests, and when I try to post using a session I get this error:</p>
<p dir="auto">File "", line 1, in<br>
File "/usr/local/lib/python2.7/dist-packages/pacer_lib/scraper.py", line 42, in init<br>
self.refresh_login()<br>
File "/usr/local/lib/python2.7/dist-packages/pacer_lib/scraper.py", line 74, in refresh_login<br>
response = self.br.post(login_url, data=payload)<br>
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 500, in post<br>
return self.request('POST', url, data=data, json=json, _kwargs)<br>
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 457, in request<br>
resp = self.send(prep, *send_kwargs)<br>
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 595, in send<br>
history = [resp for resp in gen] if allow_redirects else []<br>
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 189, in resolve_redirects<br>
allow_redirects=False,<br>
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 569, in send<br>
r = adapter.send(request, *_kwargs)<br>
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 329, in send<br>
conn = self.get_connection(request.url, proxies)<br>
File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 243, in get_connection<br>
conn = self.poolmanager.connection_from_url(url)<br>
File "/usr/lib/python2.7/dist-packages/urllib3/poolmanager.py", line 131, in connection_from_url<br>
return self.connection_from_host(u.host, port=u.port, scheme=u.scheme)<br>
File "/usr/lib/python2.7/dist-packages/urllib3/poolmanager.py", line 102, in connection_from_host<br>
raise LocationValueError("No host specified.")<br>
urllib3.exceptions.LocationValueError: No host specified.</p>
<p dir="auto">here is the relevant source from pacer_lib</p>
<p dir="auto">def refresh_login(self):<br>
"""<br>
Logs in to the PACER system using the login and password provided at<br>
the initialization of <code class="notranslate">search_agent()</code>. This will create a Requests<br>
session that will allow you to query the PACER system. If<br>
<em>auto_login</em> =False, <code class="notranslate">refresh_login()</code> must be called before you can<br>
query the case_locator. This function will raise an error if you<br>
supply an invalid login or password.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    Returns nothing.
    &quot;&quot;&quot;
    #SETTINGS (determined from the form from PACER's '/login.pl')
    payload = {'loginid':self.username, 'passwd':self.password}
    login_url = 'https://pacer.login.uscourts.gov/cgi-bin/check-pacer-passwd.pl'
    self.br = requests.Session()
    response = self.br.post(login_url, data=payload)"><pre class="notranslate"><code class="notranslate">    Returns nothing.
    """
    #SETTINGS (determined from the form from PACER's '/login.pl')
    payload = {'loginid':self.username, 'passwd':self.password}
    login_url = 'https://pacer.login.uscourts.gov/cgi-bin/check-pacer-passwd.pl'
    self.br = requests.Session()
    response = self.br.post(login_url, data=payload)
</code></pre></div>
<p dir="auto">I have tried just posting without a session and it works (at least I get a 200), but every time I try to use a session I get that same error. Any help would be greatly appreciated</p>