Can't get Proxy to work with https and http works only with auth, not like the Docu descripes

I'm trying to get requests work with an Proxy. From the Documentation it should work with this Dictionary:
`proxies = {'http' : 'http://username:password@proxy:8080',
               'https': 'https://proxy:8080'}
`
when i try:
`r = requests.get('http://google.com', proxies=proxies)`

i get this error:
requests.exceptions.ProxyError:
    HTTPConnectionPool(host='username', port=80):
    Max retries exceeded with url:
    http://google.com/
    (Caused by ProxyError('Cannot connect to proxy.',
    NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection
    object at 0x04755510>: Failed to establish a new connection:
    [Errno 11001] getaddrinfo failed',)))

If i use it like this:

```
auth = HTTPProxyAuth(username, password)
proxies = {'http' : 'http://www-proxy2-de001.d.grp:8080'}
r = requests.get('http://google.com', proxies=proxies, auth=auth)
```
Everything is fine.

Now i'm trying the same with https, but most time i get an 407, with this:
    ```
    auth = HTTPProxyAuth(username, password)
    proxies = {'http' : 'http://proxy:8080',
               'https': 'https://proxy:8080'}
    r = requests.get('https://google.com', proxies=proxies, auth=auth)
```

And with this code:
`   proxies = {'http' : 'www-proxy2-de001.d.grp:8080',
               'https': 'http://username:password@proxy:8080'}
    r = requests.get('https://google.com', proxies=proxies)`

i get this error:
raise ProxyError(e, request=request)
requests.exceptions.ProxyError: HTTPSConnectionPool(host='google.com', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x045344D0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed',)))

I have no more idea, why it is not working.

Any help are great.

Forgott something:

i use Python on WIndows WinPython-32bit-3.6.1.0Qt5
and Requests: requests==2.10.0

It's *extremely* likely that your proxy password contains an `@` symbol, which is causing our URL parsing to get confused. You need to urlencode your password (that is, run it through `urllib.quote`) before passing it to us or it gets pretty confusing.


Hi Cory, 

my password has no @ symbol. But it has an # sign. Can a # Make Problems? 
If I use http with proxy and fill in username and password in the proxies dictionary. I see my username in the error message in the URL field. 


-------- Originalnachricht --------
Betreff: Re: [kennethreitz/requests] Can't get Proxy to work with https and http works only with auth, not like the Docu descripes (#3990)
Von: Cory Benfield <notifications@github.com>
An: kennethreitz/requests <requests@noreply.github.com>
Cc: eisbaer9 <eisbaer9@gmx.de>,Author <author@noreply.github.com>

>It's *extremely* likely that your proxy password contains an `@` symbol, which is causing our URL parsing to get confused. You need to urlencode your password (that is, run it through `urllib.quote`) before passing it to us or it gets pretty confusing.
>
>
>-- 
>You are receiving this because you authored the thread.
>Reply to this email directly or view it on GitHub:
>https://github.com/kennethreitz/requests/issues/3990#issuecomment-296790541

Yes, a `#` can also cause issues. Do you have any symbols in your username, either? Both should be encoded.

No, username has only letters and number. The pass word are an # and letters and numbers. 

I try with encoding or change password to test and get back to you. 

Hi,

many thanks, urllib.quote did it! If someone has the same problem, here is my small working code Example:
`import requests
from urllib.parse import quote

username = quote('type in username')
password = quote(' type in password')
proxy = 'type in proxy name or ip'
proxy_port = '8080'

url = 'https://google.com'

proxy_http = 'http://' + username + ':' + password + '@' + proxy + ':' + proxy_port
proxy_https = 'https://' + username + ':' + password + '@' + proxy + ':' + proxy_port
    
proxies = {'http' : proxy_http, 'https': proxy_https}

r = requests.get(url, proxies=proxies)

print(r.status_code)
print(r.text)
`