{"action":"created","issue":{"url":"https://api.github.com/repos/kennethreitz/requests/issues/3050","repository_url":"https://api.github.com/repos/kennethreitz/requests","labels_url":"https://api.github.com/repos/kennethreitz/requests/issues/3050/labels{/name}","comments_url":"https://api.github.com/repos/kennethreitz/requests/issues/3050/comments","events_url":"https://api.github.com/repos/kennethreitz/requests/issues/3050/events","html_url":"https://github.com/kennethreitz/requests/issues/3050","id":140481019,"number":3050,"title":"Getting ProxyError exception out of ConnectionError ","user":{"login":"alexanderad","id":888394,"avatar_url":"https://avatars.githubusercontent.com/u/888394?v=3","gravatar_id":"","url":"https://api.github.com/users/alexanderad","html_url":"https://github.com/alexanderad","followers_url":"https://api.github.com/users/alexanderad/followers","following_url":"https://api.github.com/users/alexanderad/following{/other_user}","gists_url":"https://api.github.com/users/alexanderad/gists{/gist_id}","starred_url":"https://api.github.com/users/alexanderad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexanderad/subscriptions","organizations_url":"https://api.github.com/users/alexanderad/orgs","repos_url":"https://api.github.com/users/alexanderad/repos","events_url":"https://api.github.com/users/alexanderad/events{/privacy}","received_events_url":"https://api.github.com/users/alexanderad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-13T12:25:25Z","updated_at":"2016-03-13T12:26:00Z","closed_at":null,"body":"When a request is made via proxy and a timeout happens you'll get a `ConnectTimeout` error, which is expected:\r\n```python\r\nimport requests\r\n\r\nproxies = {\r\n  'http': 'http://10.10.1.10:3128',\r\n  'https': 'http://10.10.1.10:1080',\r\n}\r\n\r\ntry:\r\n    requests.get(\r\n        'http://httpbin.org/ip', proxies=proxies, timeout=1\r\n    ).json()\r\nexcept requests.ConnectionError as e:\r\n    print(isinstance(e, requests.exceptions.ConnectTimeout))  # true\r\n```\r\nI believe this is possible because of \"special handling\" here on [these lines](https://github.com/kennethreitz/requests/blob/master/requests/adapters.py#L429-L432).\r\n\r\nHowever, if the proxy cause a `Network unreachable` /  `No route to host` error, [you'll get](https://github.com/kennethreitz/requests/blob/master/requests/adapters.py#L437) a \"generic\" `ConnectionError`, not a specific `ProxyError` and there is actually no way to get to the `ProxyError`.\r\n\r\n> ConnectionError(MaxRetryError(\"HTTPConnectionPool(host='10.10.1.10', port=3128): Max retries exceeded with url: http://httpbin.org/ip (Caused by ProxyError('Cannot connect to proxy.', NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x10fe268d0>: Failed to establish a new connection: [Errno 51] Network is unreachable',)))\",),)\r\n\r\nThe question is: is it possible to get somehow down to, at least, `ProxyError` in this case?"},"comment":{"url":"https://api.github.com/repos/kennethreitz/requests/issues/comments/195947994","html_url":"https://github.com/kennethreitz/requests/issues/3050#issuecomment-195947994","issue_url":"https://api.github.com/repos/kennethreitz/requests/issues/3050","id":195947994,"user":{"login":"alexanderad","id":888394,"avatar_url":"https://avatars.githubusercontent.com/u/888394?v=3","gravatar_id":"","url":"https://api.github.com/users/alexanderad","html_url":"https://github.com/alexanderad","followers_url":"https://api.github.com/users/alexanderad/followers","following_url":"https://api.github.com/users/alexanderad/following{/other_user}","gists_url":"https://api.github.com/users/alexanderad/gists{/gist_id}","starred_url":"https://api.github.com/users/alexanderad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexanderad/subscriptions","organizations_url":"https://api.github.com/users/alexanderad/orgs","repos_url":"https://api.github.com/users/alexanderad/repos","events_url":"https://api.github.com/users/alexanderad/events{/privacy}","received_events_url":"https://api.github.com/users/alexanderad/received_events","type":"User","site_admin":false},"created_at":"2016-03-13T12:26:00Z","updated_at":"2016-03-13T12:26:00Z","body":"And yeah, in first place, thanks for great library, @kennethreitz and all the contributors :+1: "}}