<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; import requests
&gt;&gt;&gt; requests.get(&quot;https://r8---sn-q4f7snss.googlevideo.com&quot;)
Traceback (most recent call last):
  File &quot;/usr/local/lib/python3.4/dist-packages/requests/models.py&quot;, line 370, in prepare_url
    host = idna.encode(host, uts46=True).decode('utf-8')
  File &quot;/usr/local/lib/python3.4/dist-packages/requests/packages/idna/core.py&quot;, line 355, in encode
    result.append(alabel(label))
  File &quot;/usr/local/lib/python3.4/dist-packages/requests/packages/idna/core.py&quot;, line 276, in alabel
    check_label(label)
  File &quot;/usr/local/lib/python3.4/dist-packages/requests/packages/idna/core.py&quot;, line 253, in check_label
    raise InvalidCodepoint('Codepoint {0} at position {1} of {2} not allowed'.format(_unot(cp_value), pos+1, repr(label)))
requests.packages.idna.core.InvalidCodepoint: Codepoint U+0027 at position 2 of &quot;b'r8---sn-q4f7snss'&quot; not allowed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/local/lib/python3.4/dist-packages/requests/api.py&quot;, line 70, in get
    return request('get', url, params=params, **kwargs)
  File &quot;/usr/local/lib/python3.4/dist-packages/requests/api.py&quot;, line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File &quot;/usr/local/lib/python3.4/dist-packages/requests/sessions.py&quot;, line 474, in request
    prep = self.prepare_request(req)
  File &quot;/usr/local/lib/python3.4/dist-packages/requests/sessions.py&quot;, line 407, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File &quot;/usr/local/lib/python3.4/dist-packages/requests/models.py&quot;, line 302, in prepare
    self.prepare_url(url, params)
  File &quot;/usr/local/lib/python3.4/dist-packages/requests/models.py&quot;, line 372, in prepare_url
    raise InvalidURL('URL has an invalid label.')
requests.exceptions.InvalidURL: URL has an invalid label."><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-k">import</span> <span class="pl-s1">requests</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">requests</span>.<span class="pl-en">get</span>(<span class="pl-s">"https://r8---sn-q4f7snss.googlevideo.com"</span>)
<span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python3.4/dist-packages/requests/models.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">370</span>, <span class="pl-s1">in</span> <span class="pl-s1">prepare_url</span>
    <span class="pl-s1">host</span> <span class="pl-c1">=</span> <span class="pl-s1">idna</span>.<span class="pl-en">encode</span>(<span class="pl-s1">host</span>, <span class="pl-s1">uts46</span><span class="pl-c1">=</span><span class="pl-c1">True</span>).<span class="pl-en">decode</span>(<span class="pl-s">'utf-8'</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python3.4/dist-packages/requests/packages/idna/core.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">355</span>, <span class="pl-s1">in</span> <span class="pl-s1">encode</span>
    <span class="pl-s1">result</span>.<span class="pl-en">append</span>(<span class="pl-en">alabel</span>(<span class="pl-s1">label</span>))
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python3.4/dist-packages/requests/packages/idna/core.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">276</span>, <span class="pl-s1">in</span> <span class="pl-s1">alabel</span>
    <span class="pl-en">check_label</span>(<span class="pl-s1">label</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python3.4/dist-packages/requests/packages/idna/core.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">253</span>, <span class="pl-s1">in</span> <span class="pl-s1">check_label</span>
    <span class="pl-k">raise</span> <span class="pl-v">InvalidCodepoint</span>(<span class="pl-s">'Codepoint {0} at position {1} of {2} not allowed'</span>.<span class="pl-en">format</span>(<span class="pl-en">_unot</span>(<span class="pl-s1">cp_value</span>), <span class="pl-s1">pos</span><span class="pl-c1">+</span><span class="pl-c1">1</span>, <span class="pl-en">repr</span>(<span class="pl-s1">label</span>)))
<span class="pl-s1">requests</span>.<span class="pl-s1">packages</span>.<span class="pl-s1">idna</span>.<span class="pl-s1">core</span>.<span class="pl-v">InvalidCodepoint</span>: <span class="pl-v">Codepoint</span> <span class="pl-v">U</span><span class="pl-c1">+</span><span class="pl-c1">0027</span> <span class="pl-s1">at</span> <span class="pl-s1">position</span> <span class="pl-c1">2</span> <span class="pl-s1">of</span> <span class="pl-s">"b'r8---sn-q4f7snss'"</span> <span class="pl-c1">not</span> <span class="pl-s1">allowed</span>

<span class="pl-v">During</span> <span class="pl-s1">handling</span> <span class="pl-s1">of</span> <span class="pl-s1">the</span> <span class="pl-s1">above</span> <span class="pl-s1">exception</span>, <span class="pl-s1">another</span> <span class="pl-s1">exception</span> <span class="pl-s1">occurred</span>:

<span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"&lt;stdin&gt;"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python3.4/dist-packages/requests/api.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">70</span>, <span class="pl-s1">in</span> <span class="pl-s1">get</span>
    <span class="pl-k">return</span> <span class="pl-en">request</span>(<span class="pl-s">'get'</span>, <span class="pl-s1">url</span>, <span class="pl-s1">params</span><span class="pl-c1">=</span><span class="pl-s1">params</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python3.4/dist-packages/requests/api.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">56</span>, <span class="pl-s1">in</span> <span class="pl-s1">request</span>
    <span class="pl-k">return</span> <span class="pl-s1">session</span>.<span class="pl-en">request</span>(<span class="pl-s1">method</span><span class="pl-c1">=</span><span class="pl-s1">method</span>, <span class="pl-s1">url</span><span class="pl-c1">=</span><span class="pl-s1">url</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python3.4/dist-packages/requests/sessions.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">474</span>, <span class="pl-s1">in</span> <span class="pl-s1">request</span>
    <span class="pl-s1">prep</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">prepare_request</span>(<span class="pl-s1">req</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python3.4/dist-packages/requests/sessions.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">407</span>, <span class="pl-s1">in</span> <span class="pl-s1">prepare_request</span>
    <span class="pl-s1">hooks</span><span class="pl-c1">=</span><span class="pl-en">merge_hooks</span>(<span class="pl-s1">request</span>.<span class="pl-s1">hooks</span>, <span class="pl-s1">self</span>.<span class="pl-s1">hooks</span>),
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python3.4/dist-packages/requests/models.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">302</span>, <span class="pl-s1">in</span> <span class="pl-s1">prepare</span>
    <span class="pl-s1">self</span>.<span class="pl-en">prepare_url</span>(<span class="pl-s1">url</span>, <span class="pl-s1">params</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python3.4/dist-packages/requests/models.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">372</span>, <span class="pl-s1">in</span> <span class="pl-s1">prepare_url</span>
    <span class="pl-k">raise</span> <span class="pl-v">InvalidURL</span>(<span class="pl-s">'URL has an invalid label.'</span>)
<span class="pl-s1">requests</span>.<span class="pl-s1">exceptions</span>.<span class="pl-v">InvalidURL</span>: <span class="pl-v">URL</span> <span class="pl-s1">has</span> <span class="pl-s1">an</span> <span class="pl-s1">invalid</span> <span class="pl-s1">label</span>.</pre></div>
<p dir="auto">requests 2.12.0</p>
<p dir="auto">requests v2.12.0</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; import requests
&gt;&gt;&gt; requests.get('http://vluki_develop_624_solr:8983/solr/vluki')
Traceback (most recent call last):
  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;/usr/local/lib/python2.7/dist-packages/requests/api.py&quot;, line 70, in get
    return request('get', url, params=params, **kwargs)
  File &quot;/usr/local/lib/python2.7/dist-packages/requests/api.py&quot;, line 56, in request
    return session.request(method=method, url=url, **kwargs)
  File &quot;/usr/local/lib/python2.7/dist-packages/requests/sessions.py&quot;, line 474, in request
    prep = self.prepare_request(req)
  File &quot;/usr/local/lib/python2.7/dist-packages/requests/sessions.py&quot;, line 407, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File &quot;/usr/local/lib/python2.7/dist-packages/requests/models.py&quot;, line 302, in prepare
    self.prepare_url(url, params)
  File &quot;/usr/local/lib/python2.7/dist-packages/requests/models.py&quot;, line 372, in prepare_url
    raise InvalidURL('URL has an invalid label.')
requests.exceptions.InvalidURL: URL has an invalid label."><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-k">import</span> <span class="pl-s1">requests</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">requests</span>.<span class="pl-en">get</span>(<span class="pl-s">'http://vluki_develop_624_solr:8983/solr/vluki'</span>)
<span class="pl-v">Traceback</span> (<span class="pl-s1">most</span> <span class="pl-s1">recent</span> <span class="pl-s1">call</span> <span class="pl-s1">last</span>):
  <span class="pl-v">File</span> <span class="pl-s">"&lt;stdin&gt;"</span>, <span class="pl-s1">line</span> <span class="pl-c1">1</span>, <span class="pl-s1">in</span> <span class="pl-c1">&lt;</span><span class="pl-s1">module</span><span class="pl-c1">&gt;</span>
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python2.7/dist-packages/requests/api.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">70</span>, <span class="pl-s1">in</span> <span class="pl-s1">get</span>
    <span class="pl-k">return</span> <span class="pl-en">request</span>(<span class="pl-s">'get'</span>, <span class="pl-s1">url</span>, <span class="pl-s1">params</span><span class="pl-c1">=</span><span class="pl-s1">params</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python2.7/dist-packages/requests/api.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">56</span>, <span class="pl-s1">in</span> <span class="pl-s1">request</span>
    <span class="pl-k">return</span> <span class="pl-s1">session</span>.<span class="pl-en">request</span>(<span class="pl-s1">method</span><span class="pl-c1">=</span><span class="pl-s1">method</span>, <span class="pl-s1">url</span><span class="pl-c1">=</span><span class="pl-s1">url</span>, <span class="pl-c1">**</span><span class="pl-s1">kwargs</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python2.7/dist-packages/requests/sessions.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">474</span>, <span class="pl-s1">in</span> <span class="pl-s1">request</span>
    <span class="pl-s1">prep</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-en">prepare_request</span>(<span class="pl-s1">req</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python2.7/dist-packages/requests/sessions.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">407</span>, <span class="pl-s1">in</span> <span class="pl-s1">prepare_request</span>
    <span class="pl-s1">hooks</span><span class="pl-c1">=</span><span class="pl-en">merge_hooks</span>(<span class="pl-s1">request</span>.<span class="pl-s1">hooks</span>, <span class="pl-s1">self</span>.<span class="pl-s1">hooks</span>),
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python2.7/dist-packages/requests/models.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">302</span>, <span class="pl-s1">in</span> <span class="pl-s1">prepare</span>
    <span class="pl-s1">self</span>.<span class="pl-en">prepare_url</span>(<span class="pl-s1">url</span>, <span class="pl-s1">params</span>)
  <span class="pl-v">File</span> <span class="pl-s">"/usr/local/lib/python2.7/dist-packages/requests/models.py"</span>, <span class="pl-s1">line</span> <span class="pl-c1">372</span>, <span class="pl-s1">in</span> <span class="pl-s1">prepare_url</span>
    <span class="pl-k">raise</span> <span class="pl-v">InvalidURL</span>(<span class="pl-s">'URL has an invalid label.'</span>)
<span class="pl-s1">requests</span>.<span class="pl-s1">exceptions</span>.<span class="pl-v">InvalidURL</span>: <span class="pl-v">URL</span> <span class="pl-s1">has</span> <span class="pl-s1">an</span> <span class="pl-s1">invalid</span> <span class="pl-s1">label</span>.</pre></div>