PIP how escape character # in password?
<p>want to continue question
<a href="http://stackoverflow.com/questions/19080352/how-to-get-pip-to-work-behind-a-proxy-server/39206294#39206294">How to get pip to work behind a proxy server</a></p>

<p>I have Windows Server and Python 3.5 (64).</p>

<p>In password my user include #.</p>

<p>I try to use some solve:</p>

<pre>
"C:\Program Files\Python35\scripts\pip.exe" install --proxy http://proxy_user:pwd#123@proxy.su:1111 TwitterApi

"C:\Program Files\Python35\scripts\pip.exe" install --proxy "http://proxy_user:pwd#123"@proxy.su:1111 TwitterApi

"C:\Program Files\Python35\scripts\pip.exe" install --proxy http://"proxy_user:pwd#123"@proxy.su:1111 TwitterApi

"C:\Program Files\Python35\scripts\pip.exe" install --proxy http://proxy_user:"pwd#123"@proxy.su:1111 TwitterApi
</pre>

<p>BUT to get error</p>

<pre>
  File "c:\program files\python35\lib\site-packages\pip\_vendor\requests\package
s\urllib3\util\url.py", line 189, in parse_url
    raise LocationParseError(url)
pip._vendor.requests.packages.urllib3.exceptions.LocationParseError: Failed to p
arse: proxy_user:pwd
</pre>

<p>How escape character # in this case?</p>

<p><strong>Quick way out</strong>: Enter it in the encoded form i.e. <code># -&gt; %23</code></p>

<p>OR </p>

<blockquote>
  <p>A better way for pip to handle this might be to add a <code>--proxy-auth</code>
  flag that takes : and does the encoding for the
  user before adding it to the Proxy URL.</p>
</blockquote>

<hr>

<p><strong>Issue</strong> - This is something not allowed: </p>

<blockquote>
  <p>Strictly speaking, the literal # character is not valid in the
  userinfo portion of a URI, according to RFC 3986, and should be
  percent encoded. However, it's not exactly a surprise that many tools
  handle this ok: there's clearly no actual ambiguity about that
  character. Note, however, that if there were an @ symbol in the
  password you'd definitely have to urlencode it: for that reason, it's
  a good habit to get into to urlencode your passwords before they go
  into URIs.</p>
</blockquote>

<p>The response to a submitted issue <a href="https://github.com/shazow/urllib3/issues/814" rel="nofollow">parse_url fails when given credentials in the URL with '/', '#', or '?'</a>: </p>

<blockquote>
  <p><a href="https://github.com/shazow/urllib3/issues/814#issuecomment-197046251" rel="nofollow">The RFC says specifically</a>:</p>
  
  <p>The authority component is preceded by a double slash ("<code>//</code>") and is
  terminated by the next slash ("<code>/</code>"), question mark ("?"), or number
  sign ("<code>#</code>") character, or by the end of the URI. In other words, the
  current behaviour is correct in expecting the authority to be
  terminated by the first <code>/</code> (or ? or <code>#</code>) it finds after the preceeding
  <code>//</code>. Am I sympathetic to people trying to use proxy URIs with pip?
  Absolutely. I think hacking together something that violates the RFC
  has the potential for nasty surprises later on.</p>
</blockquote>

<hr>

python python-3.x pip http-proxy