{"action":"created","comment":{"url":"https://api.github.com/repos/certbot/certbot/pulls/comments/130964674","pull_request_review_id":53897073,"id":130964674,"diff_hunk":"@@ -624,7 +627,31 @@ def _send_request(self, method, url, *args, **kwargs):\n         kwargs.setdefault('headers', {})\n         kwargs['headers'].setdefault('User-Agent', self.user_agent)\n         kwargs.setdefault('timeout', self._default_timeout)\n-        response = self.session.request(method, url, *args, **kwargs)\n+        try:\n+            response = self.session.request(method, url, *args, **kwargs)\n+        except requests.exceptions.RequestException as e:\n+            #pylint: disable=pointless-string-statement\n+            \"\"\"Requests response parsing\n+\n+            The requests library emits exceptions with a lot of extra text.\n+            We parse them with a regexp to raise a more readable exceptions.\n+\n+            Example:\n+            HTTPSConnectionPool(host='acme-v01.api.letsencrypt.org',\n+            port=443): Max retries exceeded with url: /directory\n+            (Caused by NewConnectionError('\n+            <requests.packages.urllib3.connection.VerifiedHTTPSConnection\n+            object at 0x108356c50>: Failed to establish a new connection:\n+            [Errno 65] No route to host',))\"\"\"\n+\n+            err_regex = r\".*host='(\\S*)'.*url\\: (\\/\\w*).*(\\[Errno \\d+\\])([A-Za-z ]*)\"","path":"acme/acme/client.py","position":38,"original_position":39,"commit_id":"18d3df78e8cc7ae498ba411fea155a227cb91642","original_commit_id":"4f9dbcd5725b93e99f733b15cd569b7b689363ae","user":{"login":"bobstrecansky","id":4099109,"avatar_url":"https://avatars0.githubusercontent.com/u/4099109?v=4","gravatar_id":"","url":"https://api.github.com/users/bobstrecansky","html_url":"https://github.com/bobstrecansky","followers_url":"https://api.github.com/users/bobstrecansky/followers","following_url":"https://api.github.com/users/bobstrecansky/following{/other_user}","gists_url":"https://api.github.com/users/bobstrecansky/gists{/gist_id}","starred_url":"https://api.github.com/users/bobstrecansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobstrecansky/subscriptions","organizations_url":"https://api.github.com/users/bobstrecansky/orgs","repos_url":"https://api.github.com/users/bobstrecansky/repos","events_url":"https://api.github.com/users/bobstrecansky/events{/privacy}","received_events_url":"https://api.github.com/users/bobstrecansky/received_events","type":"User","site_admin":false},"body":"We may be able to anchor with HTTPSConnectionPool; this is the full error message that gets spit back:\r\n\r\n`ConnectionError: HTTPSConnectionPool(host='acme-v01.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x109dbb110>: Failed to establish a new connection: [Errno 65] No route to host',))`","created_at":"2017-08-02T18:53:27Z","updated_at":"2017-08-02T18:53:27Z","html_url":"https://github.com/certbot/certbot/pull/4733#discussion_r130964674","pull_request_url":"https://api.github.com/repos/certbot/certbot/pulls/4733","_links":{"self":{"href":"https://api.github.com/repos/certbot/certbot/pulls/comments/130964674"},"html":{"href":"https://github.com/certbot/certbot/pull/4733#discussion_r130964674"},"pull_request":{"href":"https://api.github.com/repos/certbot/certbot/pulls/4733"}}},"pull_request":{"url":"https://api.github.com/repos/certbot/certbot/pulls/4733","id":122310669,"html_url":"https://github.com/certbot/certbot/pull/4733","diff_url":"https://github.com/certbot/certbot/pull/4733.diff","patch_url":"https://github.com/certbot/certbot/pull/4733.patch","issue_url":"https://api.github.com/repos/certbot/certbot/issues/4733","number":4733,"state":"open","locked":false,"title":"[#4535] - Unwrap 'max retries exceeded' errors","user":{"login":"bobstrecansky","id":4099109,"avatar_url":"https://avatars0.githubusercontent.com/u/4099109?v=4","gravatar_id":"","url":"https://api.github.com/users/bobstrecansky","html_url":"https://github.com/bobstrecansky","followers_url":"https://api.github.com/users/bobstrecansky/followers","following_url":"https://api.github.com/users/bobstrecansky/following{/other_user}","gists_url":"https://api.github.com/users/bobstrecansky/gists{/gist_id}","starred_url":"https://api.github.com/users/bobstrecansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobstrecansky/subscriptions","organizations_url":"https://api.github.com/users/bobstrecansky/orgs","repos_url":"https://api.github.com/users/bobstrecansky/repos","events_url":"https://api.github.com/users/bobstrecansky/events{/privacy}","received_events_url":"https://api.github.com/users/bobstrecansky/received_events","type":"User","site_admin":false},"body":"This should help out with https://github.com/certbot/certbot/issues/4535\r\nutilizing regex to parse out the relevant error messages and displaying them back out to stdout if we fail to connect to the proper host.  This should pass back the urllib3 responses in a more readable fashion.  \r\n\r\nExample test with acme routed to localhost:\r\n\r\n```\r\n[12:55:16] bstrecansky ~ tail -1 /etc/hosts\r\n127.0.0.1\tacme-v01.api.letsencrypt.org\r\n```\r\n\r\n```\r\nvenv)[12:52:29] bstrecansky certbot max_retries_exceeded ~ sudo certbot                                                       1 ↵\r\nSaving debug log to /var/log/letsencrypt/letsencrypt.log\r\nAn unexpected error occurred:\r\nCan't connect to acme-v01.api.letsencrypt.org\r\n[Errno 65] - No route to host\r\nPlease see the logfiles in /var/log/letsencrypt for more details.\r\n```","created_at":"2017-05-24T19:57:28Z","updated_at":"2017-08-02T18:53:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac45385a97bb7bd70b8ec8e32789abee06e1525f","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/certbot/certbot/pulls/4733/commits","review_comments_url":"https://api.github.com/repos/certbot/certbot/pulls/4733/comments","review_comment_url":"https://api.github.com/repos/certbot/certbot/pulls/comments{/number}","comments_url":"https://api.github.com/repos/certbot/certbot/issues/4733/comments","statuses_url":"https://api.github.com/repos/certbot/certbot/statuses/18d3df78e8cc7ae498ba411fea155a227cb91642","head":{"label":"bobstrecansky:max_retries_exceeded","ref":"max_retries_exceeded","sha":"18d3df78e8cc7ae498ba411fea155a227cb91642","user":{"login":"bobstrecansky","id":4099109,"avatar_url":"https://avatars0.githubusercontent.com/u/4099109?v=4","gravatar_id":"","url":"https://api.github.com/users/bobstrecansky","html_url":"https://github.com/bobstrecansky","followers_url":"https://api.github.com/users/bobstrecansky/followers","following_url":"https://api.github.com/users/bobstrecansky/following{/other_user}","gists_url":"https://api.github.com/users/bobstrecansky/gists{/gist_id}","starred_url":"https://api.github.com/users/bobstrecansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobstrecansky/subscriptions","organizations_url":"https://api.github.com/users/bobstrecansky/orgs","repos_url":"https://api.github.com/users/bobstrecansky/repos","events_url":"https://api.github.com/users/bobstrecansky/events{/privacy}","received_events_url":"https://api.github.com/users/bobstrecansky/received_events","type":"User","site_admin":false},"repo":{"id":92106393,"name":"certbot","full_name":"bobstrecansky/certbot","owner":{"login":"bobstrecansky","id":4099109,"avatar_url":"https://avatars0.githubusercontent.com/u/4099109?v=4","gravatar_id":"","url":"https://api.github.com/users/bobstrecansky","html_url":"https://github.com/bobstrecansky","followers_url":"https://api.github.com/users/bobstrecansky/followers","following_url":"https://api.github.com/users/bobstrecansky/following{/other_user}","gists_url":"https://api.github.com/users/bobstrecansky/gists{/gist_id}","starred_url":"https://api.github.com/users/bobstrecansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bobstrecansky/subscriptions","organizations_url":"https://api.github.com/users/bobstrecansky/orgs","repos_url":"https://api.github.com/users/bobstrecansky/repos","events_url":"https://api.github.com/users/bobstrecansky/events{/privacy}","received_events_url":"https://api.github.com/users/bobstrecansky/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bobstrecansky/certbot","description":"Certbot, previously the Let's Encrypt Client, is EFF's tool to obtain certs from Let's Encrypt, and (optionally) auto-enable HTTPS on your server.  It can also act as a client for any other CA that uses the ACME protocol.","fork":true,"url":"https://api.github.com/repos/bobstrecansky/certbot","forks_url":"https://api.github.com/repos/bobstrecansky/certbot/forks","keys_url":"https://api.github.com/repos/bobstrecansky/certbot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bobstrecansky/certbot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bobstrecansky/certbot/teams","hooks_url":"https://api.github.com/repos/bobstrecansky/certbot/hooks","issue_events_url":"https://api.github.com/repos/bobstrecansky/certbot/issues/events{/number}","events_url":"https://api.github.com/repos/bobstrecansky/certbot/events","assignees_url":"https://api.github.com/repos/bobstrecansky/certbot/assignees{/user}","branches_url":"https://api.github.com/repos/bobstrecansky/certbot/branches{/branch}","tags_url":"https://api.github.com/repos/bobstrecansky/certbot/tags","blobs_url":"https://api.github.com/repos/bobstrecansky/certbot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bobstrecansky/certbot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bobstrecansky/certbot/git/refs{/sha}","trees_url":"https://api.github.com/repos/bobstrecansky/certbot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bobstrecansky/certbot/statuses/{sha}","languages_url":"https://api.github.com/repos/bobstrecansky/certbot/languages","stargazers_url":"https://api.github.com/repos/bobstrecansky/certbot/stargazers","contributors_url":"https://api.github.com/repos/bobstrecansky/certbot/contributors","subscribers_url":"https://api.github.com/repos/bobstrecansky/certbot/subscribers","subscription_url":"https://api.github.com/repos/bobstrecansky/certbot/subscription","commits_url":"https://api.github.com/repos/bobstrecansky/certbot/commits{/sha}","git_commits_url":"https://api.github.com/repos/bobstrecansky/certbot/git/commits{/sha}","comments_url":"https://api.github.com/repos/bobstrecansky/certbot/comments{/number}","issue_comment_url":"https://api.github.com/repos/bobstrecansky/certbot/issues/comments{/number}","contents_url":"https://api.github.com/repos/bobstrecansky/certbot/contents/{+path}","compare_url":"https://api.github.com/repos/bobstrecansky/certbot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bobstrecansky/certbot/merges","archive_url":"https://api.github.com/repos/bobstrecansky/certbot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bobstrecansky/certbot/downloads","issues_url":"https://api.github.com/repos/bobstrecansky/certbot/issues{/number}","pulls_url":"https://api.github.com/repos/bobstrecansky/certbot/pulls{/number}","milestones_url":"https://api.github.com/repos/bobstrecansky/certbot/milestones{/number}","notifications_url":"https://api.github.com/repos/bobstrecansky/certbot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bobstrecansky/certbot/labels{/name}","releases_url":"https://api.github.com/repos/bobstrecansky/certbot/releases{/id}","deployments_url":"https://api.github.com/repos/bobstrecansky/certbot/deployments","created_at":"2017-05-22T22:55:19Z","updated_at":"2017-05-22T22:55:23Z","pushed_at":"2017-07-27T00:37:20Z","git_url":"git://github.com/bobstrecansky/certbot.git","ssh_url":"git@github.com:bobstrecansky/certbot.git","clone_url":"https://github.com/bobstrecansky/certbot.git","svn_url":"https://github.com/bobstrecansky/certbot","homepage":"","size":14755,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"certbot:master","ref":"master","sha":"0321c0cb4cc1515efc1f787678c50874a911d38a","user":{"login":"certbot","id":17889013,"avatar_url":"https://avatars2.githubusercontent.com/u/17889013?v=4","gravatar_id":"","url":"https://api.github.com/users/certbot","html_url":"https://github.com/certbot","followers_url":"https://api.github.com/users/certbot/followers","following_url":"https://api.github.com/users/certbot/following{/other_user}","gists_url":"https://api.github.com/users/certbot/gists{/gist_id}","starred_url":"https://api.github.com/users/certbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/certbot/subscriptions","organizations_url":"https://api.github.com/users/certbot/orgs","repos_url":"https://api.github.com/users/certbot/repos","events_url":"https://api.github.com/users/certbot/events{/privacy}","received_events_url":"https://api.github.com/users/certbot/received_events","type":"Organization","site_admin":false},"repo":{"id":26516210,"name":"certbot","full_name":"certbot/certbot","owner":{"login":"certbot","id":17889013,"avatar_url":"https://avatars2.githubusercontent.com/u/17889013?v=4","gravatar_id":"","url":"https://api.github.com/users/certbot","html_url":"https://github.com/certbot","followers_url":"https://api.github.com/users/certbot/followers","following_url":"https://api.github.com/users/certbot/following{/other_user}","gists_url":"https://api.github.com/users/certbot/gists{/gist_id}","starred_url":"https://api.github.com/users/certbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/certbot/subscriptions","organizations_url":"https://api.github.com/users/certbot/orgs","repos_url":"https://api.github.com/users/certbot/repos","events_url":"https://api.github.com/users/certbot/events{/privacy}","received_events_url":"https://api.github.com/users/certbot/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/certbot/certbot","description":"Certbot, previously the Let's Encrypt Client, is EFF's tool to obtain certs from Let's Encrypt, and (optionally) auto-enable HTTPS on your server.  It can also act as a client for any other CA that uses the ACME protocol.","fork":false,"url":"https://api.github.com/repos/certbot/certbot","forks_url":"https://api.github.com/repos/certbot/certbot/forks","keys_url":"https://api.github.com/repos/certbot/certbot/keys{/key_id}","collaborators_url":"https://api.github.com/repos/certbot/certbot/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/certbot/certbot/teams","hooks_url":"https://api.github.com/repos/certbot/certbot/hooks","issue_events_url":"https://api.github.com/repos/certbot/certbot/issues/events{/number}","events_url":"https://api.github.com/repos/certbot/certbot/events","assignees_url":"https://api.github.com/repos/certbot/certbot/assignees{/user}","branches_url":"https://api.github.com/repos/certbot/certbot/branches{/branch}","tags_url":"https://api.github.com/repos/certbot/certbot/tags","blobs_url":"https://api.github.com/repos/certbot/certbot/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/certbot/certbot/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/certbot/certbot/git/refs{/sha}","trees_url":"https://api.github.com/repos/certbot/certbot/git/trees{/sha}","statuses_url":"https://api.github.com/repos/certbot/certbot/statuses/{sha}","languages_url":"https://api.github.com/repos/certbot/certbot/languages","stargazers_url":"https://api.github.com/repos/certbot/certbot/stargazers","contributors_url":"https://api.github.com/repos/certbot/certbot/contributors","subscribers_url":"https://api.github.com/repos/certbot/certbot/subscribers","subscription_url":"https://api.github.com/repos/certbot/certbot/subscription","commits_url":"https://api.github.com/repos/certbot/certbot/commits{/sha}","git_commits_url":"https://api.github.com/repos/certbot/certbot/git/commits{/sha}","comments_url":"https://api.github.com/repos/certbot/certbot/comments{/number}","issue_comment_url":"https://api.github.com/repos/certbot/certbot/issues/comments{/number}","contents_url":"https://api.github.com/repos/certbot/certbot/contents/{+path}","compare_url":"https://api.github.com/repos/certbot/certbot/compare/{base}...{head}","merges_url":"https://api.github.com/repos/certbot/certbot/merges","archive_url":"https://api.github.com/repos/certbot/certbot/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/certbot/certbot/downloads","issues_url":"https://api.github.com/repos/certbot/certbot/issues{/number}","pulls_url":"https://api.github.com/repos/certbot/certbot/pulls{/number}","milestones_url":"https://api.github.com/repos/certbot/certbot/milestones{/number}","notifications_url":"https://api.github.com/repos/certbot/certbot/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/certbot/certbot/labels{/name}","releases_url":"https://api.github.com/repos/certbot/certbot/releases{/id}","deployments_url":"https://api.github.com/repos/certbot/certbot/deployments","created_at":"2014-11-12T02:52:20Z","updated_at":"2017-08-02T17:19:07Z","pushed_at":"2017-08-02T18:36:20Z","git_url":"git://github.com/certbot/certbot.git","ssh_url":"git@github.com:certbot/certbot.git","clone_url":"https://github.com/certbot/certbot.git","svn_url":"https://github.com/certbot/certbot","homepage":"","size":14942,"stargazers_count":19179,"watchers_count":19179,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1743,"mirror_url":null,"open_issues_count":854,"forks":1743,"open_issues":854,"watchers":19179,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/certbot/certbot/pulls/4733"},"html":{"href":"https://github.com/certbot/certbot/pull/4733"},"issue":{"href":"https://api.github.com/repos/certbot/certbot/issues/4733"},"comments":{"href":"https://api.github.com/repos/certbot/certbot/issues/4733/comments"},"review_comments":{"href":"https://api.github.com/repos/certbot/certbot/pulls/4733/comments"},"review_comment":{"href":"https://api.github.com/repos/certbot/certbot/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/certbot/certbot/pulls/4733/commits"},"statuses":{"href":"https://api.github.com/repos/certbot/certbot/statuses/18d3df78e8cc7ae498ba411fea155a227cb91642"}}}}
{"actor":{"display_login":"bobstrecansky"}}