We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
timeout on certbot-auto update check if pypy.python.org is unreachable
similar to #4074, #3313, #3636
## My operating system is (include version):
`Linux Debian-85-jessie-64-minimal 4.9.0-2-amd64 #1 SMP Debian 4.9.13-1 (2017-02-27) x86_64 GNU/Linux`

## I installed Certbot with (certbot-auto, OS package manager, pip, etc):
git clone (certbot-auto)

## I ran this command and it produced this output:
When I try to run certbot-auto nothing happens until I press CTRL+C and get:
```
Traceback (most recent call last):
  File "/tmp/tmp.bPi8RZRS1H/fetch.py", line 126, in <module>
    exit(main())
  File "/tmp/tmp.bPi8RZRS1H/fetch.py", line 114, in main
    print latest_stable_version(get)
  File "/tmp/tmp.bPi8RZRS1H/fetch.py", line 71, in latest_stable_version
    'https://pypi.python.org/pypi/certbot/json')))
  File "/tmp/tmp.bPi8RZRS1H/fetch.py", line 56, in get
    return self._opener.open(url).read()
  File "/usr/lib/python2.7/urllib2.py", line 429, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 447, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1241, in https_open
    context=self._context)
  File "/usr/lib/python2.7/urllib2.py", line 1201, in do_open
    r = h.getresponse(buffering=True)
  File "/usr/lib/python2.7/httplib.py", line 1121, in getresponse
    response.begin()
  File "/usr/lib/python2.7/httplib.py", line 438, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python2.7/httplib.py", line 394, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "/usr/lib/python2.7/socket.py", line 480, in readline
    data = self._sock.recv(self._rbufsize)
  File "/usr/lib/python2.7/ssl.py", line 766, in recv
    return self.read(buflen)
  File "/usr/lib/python2.7/ssl.py", line 653, in read
    v = self._sslobj.read(len)
KeyboardInterrupt
```
`curl https://pypi.python.org/pypi/certbot/json` also just hangs on my server and on my local computer

The error seems to be at pypi.python.org:
![screenshot_20170406_143445](https://cloud.githubusercontent.com/assets/6266037/24754331/4ce0594a-1ad6-11e7-8c30-5089a363cfa3.png)


## Certbot's behavior differed from what I expected because:

It would be nice if certbot could skip the version check if pypi.python.org is not available.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `letsencrypt-auto-source/pieces/fetch.py`
Content:
```
1 """Do downloading and JSON parsing without additional dependencies. ::
2 
3     # Print latest released version of LE to stdout:
4     python fetch.py --latest-version
5 
6     # Download letsencrypt-auto script from git tag v1.2.3 into the folder I'm
7     # in, and make sure its signature verifies:
8     python fetch.py --le-auto-script v1.2.3
9 
10 On failure, return non-zero.
11 
12 """
13 
14 from __future__ import print_function
15 
16 from distutils.version import LooseVersion
17 from json import loads
18 from os import devnull, environ
19 from os.path import dirname, join
20 import re
21 from subprocess import check_call, CalledProcessError
22 from sys import argv, exit
23 from urllib2 import build_opener, HTTPHandler, HTTPSHandler, HTTPError
24 
25 PUBLIC_KEY = environ.get('LE_AUTO_PUBLIC_KEY', """-----BEGIN PUBLIC KEY-----
26 MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6MR8W/galdxnpGqBsYbq
27 OzQb2eyW15YFjDDEMI0ZOzt8f504obNs920lDnpPD2/KqgsfjOgw2K7xWDJIj/18
28 xUvWPk3LDkrnokNiRkA3KOx3W6fHycKL+zID7zy+xZYBuh2fLyQtWV1VGQ45iNRp
29 9+Zo7rH86cdfgkdnWTlNSHyTLW9NbXvyv/E12bppPcEvgCTAQXgnDVJ0/sqmeiij
30 n9tTFh03aM+R2V/21h8aTraAS24qiPCz6gkmYGC8yr6mglcnNoYbsLNYZ69zF1XH
31 cXPduCPdPdfLlzVlKK1/U7hkA28eG3BIAMh6uJYBRJTpiGgaGdPd7YekUB8S6cy+
32 CQIDAQAB
33 -----END PUBLIC KEY-----
34 """)
35 
36 class ExpectedError(Exception):
37     """A novice-readable exception that also carries the original exception for
38     debugging"""
39 
40 
41 class HttpsGetter(object):
42     def __init__(self):
43         """Build an HTTPS opener."""
44         # Based on pip 1.4.1's URLOpener
45         # This verifies certs on only Python >=2.7.9.
46         self._opener = build_opener(HTTPSHandler())
47         # Strip out HTTPHandler to prevent MITM spoof:
48         for handler in self._opener.handlers:
49             if isinstance(handler, HTTPHandler):
50                 self._opener.handlers.remove(handler)
51 
52     def get(self, url):
53         """Return the document contents pointed to by an HTTPS URL.
54 
55         If something goes wrong (404, timeout, etc.), raise ExpectedError.
56 
57         """
58         try:
59             return self._opener.open(url).read()
60         except (HTTPError, IOError) as exc:
61             raise ExpectedError("Couldn't download %s." % url, exc)
62 
63 
64 def write(contents, dir, filename):
65     """Write something to a file in a certain directory."""
66     with open(join(dir, filename), 'w') as file:
67         file.write(contents)
68 
69 
70 def latest_stable_version(get):
71     """Return the latest stable release of letsencrypt."""
72     metadata = loads(get(
73         environ.get('LE_AUTO_JSON_URL',
74                     'https://pypi.python.org/pypi/certbot/json')))
75     # metadata['info']['version'] actually returns the latest of any kind of
76     # release release, contrary to https://wiki.python.org/moin/PyPIJSON.
77     # The regex is a sufficient regex for picking out prereleases for most
78     # packages, LE included.
79     return str(max(LooseVersion(r) for r
80                    in metadata['releases'].iterkeys()
81                    if re.match('^[0-9.]+$', r)))
82 
83 
84 def verified_new_le_auto(get, tag, temp_dir):
85     """Return the path to a verified, up-to-date letsencrypt-auto script.
86 
87     If the download's signature does not verify or something else goes wrong
88     with the verification process, raise ExpectedError.
89 
90     """
91     le_auto_dir = environ.get(
92         'LE_AUTO_DIR_TEMPLATE',
93         'https://raw.githubusercontent.com/certbot/certbot/%s/'
94         'letsencrypt-auto-source/') % tag
95     write(get(le_auto_dir + 'letsencrypt-auto'), temp_dir, 'letsencrypt-auto')
96     write(get(le_auto_dir + 'letsencrypt-auto.sig'), temp_dir, 'letsencrypt-auto.sig')
97     write(PUBLIC_KEY, temp_dir, 'public_key.pem')
98     try:
99         with open(devnull, 'w') as dev_null:
100             check_call(['openssl', 'dgst', '-sha256', '-verify',
101                         join(temp_dir, 'public_key.pem'),
102                         '-signature',
103                         join(temp_dir, 'letsencrypt-auto.sig'),
104                         join(temp_dir, 'letsencrypt-auto')],
105                        stdout=dev_null,
106                        stderr=dev_null)
107     except CalledProcessError as exc:
108         raise ExpectedError("Couldn't verify signature of downloaded "
109                             "certbot-auto.", exc)
110 
111 
112 def main():
113     get = HttpsGetter().get
114     flag = argv[1]
115     try:
116         if flag == '--latest-version':
117             print(latest_stable_version(get))
118         elif flag == '--le-auto-script':
119             tag = argv[2]
120             verified_new_le_auto(get, tag, dirname(argv[0]))
121     except ExpectedError as exc:
122         print(exc.args[0], exc.args[1])
123         return 1
124     else:
125         return 0
126 
127 
128 if __name__ == '__main__':
129     exit(main())
130
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/letsencrypt-auto-source/pieces/fetch.py b/letsencrypt-auto-source/pieces/fetch.py
--- a/letsencrypt-auto-source/pieces/fetch.py
+++ b/letsencrypt-auto-source/pieces/fetch.py
@@ -20,7 +20,8 @@
 import re
 from subprocess import check_call, CalledProcessError
 from sys import argv, exit
-from urllib2 import build_opener, HTTPHandler, HTTPSHandler, HTTPError
+from urllib2 import build_opener, HTTPHandler, HTTPSHandler
+from urllib2 import HTTPError, URLError
 
 PUBLIC_KEY = environ.get('LE_AUTO_PUBLIC_KEY', """-----BEGIN PUBLIC KEY-----
 MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6MR8W/galdxnpGqBsYbq
@@ -56,7 +57,9 @@
 
         """
         try:
-            return self._opener.open(url).read()
+            # socket module docs say default timeout is None: that is, no
+            # timeout
+            return self._opener.open(url, timeout=30).read()
         except (HTTPError, IOError) as exc:
             raise ExpectedError("Couldn't download %s." % url, exc)

{"golden_diff": "diff --git a/letsencrypt-auto-source/pieces/fetch.py b/letsencrypt-auto-source/pieces/fetch.py\n--- a/letsencrypt-auto-source/pieces/fetch.py\n+++ b/letsencrypt-auto-source/pieces/fetch.py\n@@ -20,7 +20,8 @@\n import re\n from subprocess import check_call, CalledProcessError\n from sys import argv, exit\n-from urllib2 import build_opener, HTTPHandler, HTTPSHandler, HTTPError\n+from urllib2 import build_opener, HTTPHandler, HTTPSHandler\n+from urllib2 import HTTPError, URLError\n \n PUBLIC_KEY = environ.get('LE_AUTO_PUBLIC_KEY', \"\"\"-----BEGIN PUBLIC KEY-----\n MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6MR8W/galdxnpGqBsYbq\n@@ -56,7 +57,9 @@\n \n         \"\"\"\n         try:\n-            return self._opener.open(url).read()\n+            # socket module docs say default timeout is None: that is, no\n+            # timeout\n+            return self._opener.open(url, timeout=30).read()\n         except (HTTPError, IOError) as exc:\n             raise ExpectedError(\"Couldn't download %s.\" % url, exc)\n", "issue": "timeout on certbot-auto update check if pypy.python.org is unreachable\nsimilar to #4074, #3313, #3636\r\n## My operating system is (include version):\r\n`Linux Debian-85-jessie-64-minimal 4.9.0-2-amd64 #1 SMP Debian 4.9.13-1 (2017-02-27) x86_64 GNU/Linux`\r\n\r\n## I installed Certbot with (certbot-auto, OS package manager, pip, etc):\r\ngit clone (certbot-auto)\r\n\r\n## I ran this command and it produced this output:\r\nWhen I try to run certbot-auto nothing happens until I press CTRL+C and get:\r\n```\r\nTraceback (most recent call last):\r\n  File \"/tmp/tmp.bPi8RZRS1H/fetch.py\", line 126, in <module>\r\n    exit(main())\r\n  File \"/tmp/tmp.bPi8RZRS1H/fetch.py\", line 114, in main\r\n    print latest_stable_version(get)\r\n  File \"/tmp/tmp.bPi8RZRS1H/fetch.py\", line 71, in latest_stable_version\r\n    'https://pypi.python.org/pypi/certbot/json')))\r\n  File \"/tmp/tmp.bPi8RZRS1H/fetch.py\", line 56, in get\r\n    return self._opener.open(url).read()\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 429, in open\r\n    response = self._open(req, data)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 447, in _open\r\n    '_open', req)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 407, in _call_chain\r\n    result = func(*args)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 1241, in https_open\r\n    context=self._context)\r\n  File \"/usr/lib/python2.7/urllib2.py\", line 1201, in do_open\r\n    r = h.getresponse(buffering=True)\r\n  File \"/usr/lib/python2.7/httplib.py\", line 1121, in getresponse\r\n    response.begin()\r\n  File \"/usr/lib/python2.7/httplib.py\", line 438, in begin\r\n    version, status, reason = self._read_status()\r\n  File \"/usr/lib/python2.7/httplib.py\", line 394, in _read_status\r\n    line = self.fp.readline(_MAXLINE + 1)\r\n  File \"/usr/lib/python2.7/socket.py\", line 480, in readline\r\n    data = self._sock.recv(self._rbufsize)\r\n  File \"/usr/lib/python2.7/ssl.py\", line 766, in recv\r\n    return self.read(buflen)\r\n  File \"/usr/lib/python2.7/ssl.py\", line 653, in read\r\n    v = self._sslobj.read(len)\r\nKeyboardInterrupt\r\n```\r\n`curl https://pypi.python.org/pypi/certbot/json` also just hangs on my server and on my local computer\r\n\r\nThe error seems to be at pypi.python.org:\r\n![screenshot_20170406_143445](https://cloud.githubusercontent.com/assets/6266037/24754331/4ce0594a-1ad6-11e7-8c30-5089a363cfa3.png)\r\n\r\n\r\n## Certbot's behavior differed from what I expected because:\r\n\r\nIt would be nice if certbot could skip the version check if pypi.python.org is not available.\n", "before_files": [{"content": "\"\"\"Do downloading and JSON parsing without additional dependencies. ::\n\n    # Print latest released version of LE to stdout:\n    python fetch.py --latest-version\n\n    # Download letsencrypt-auto script from git tag v1.2.3 into the folder I'm\n    # in, and make sure its signature verifies:\n    python fetch.py --le-auto-script v1.2.3\n\nOn failure, return non-zero.\n\n\"\"\"\n\nfrom __future__ import print_function\n\nfrom distutils.version import LooseVersion\nfrom json import loads\nfrom os import devnull, environ\nfrom os.path import dirname, join\nimport re\nfrom subprocess import check_call, CalledProcessError\nfrom sys import argv, exit\nfrom urllib2 import build_opener, HTTPHandler, HTTPSHandler, HTTPError\n\nPUBLIC_KEY = environ.get('LE_AUTO_PUBLIC_KEY', \"\"\"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6MR8W/galdxnpGqBsYbq\nOzQb2eyW15YFjDDEMI0ZOzt8f504obNs920lDnpPD2/KqgsfjOgw2K7xWDJIj/18\nxUvWPk3LDkrnokNiRkA3KOx3W6fHycKL+zID7zy+xZYBuh2fLyQtWV1VGQ45iNRp\n9+Zo7rH86cdfgkdnWTlNSHyTLW9NbXvyv/E12bppPcEvgCTAQXgnDVJ0/sqmeiij\nn9tTFh03aM+R2V/21h8aTraAS24qiPCz6gkmYGC8yr6mglcnNoYbsLNYZ69zF1XH\ncXPduCPdPdfLlzVlKK1/U7hkA28eG3BIAMh6uJYBRJTpiGgaGdPd7YekUB8S6cy+\nCQIDAQAB\n-----END PUBLIC KEY-----\n\"\"\")\n\nclass ExpectedError(Exception):\n    \"\"\"A novice-readable exception that also carries the original exception for\n    debugging\"\"\"\n\n\nclass HttpsGetter(object):\n    def __init__(self):\n        \"\"\"Build an HTTPS opener.\"\"\"\n        # Based on pip 1.4.1's URLOpener\n        # This verifies certs on only Python >=2.7.9.\n        self._opener = build_opener(HTTPSHandler())\n        # Strip out HTTPHandler to prevent MITM spoof:\n        for handler in self._opener.handlers:\n            if isinstance(handler, HTTPHandler):\n                self._opener.handlers.remove(handler)\n\n    def get(self, url):\n        \"\"\"Return the document contents pointed to by an HTTPS URL.\n\n        If something goes wrong (404, timeout, etc.), raise ExpectedError.\n\n        \"\"\"\n        try:\n            return self._opener.open(url).read()\n        except (HTTPError, IOError) as exc:\n            raise ExpectedError(\"Couldn't download %s.\" % url, exc)\n\n\ndef write(contents, dir, filename):\n    \"\"\"Write something to a file in a certain directory.\"\"\"\n    with open(join(dir, filename), 'w') as file:\n        file.write(contents)\n\n\ndef latest_stable_version(get):\n    \"\"\"Return the latest stable release of letsencrypt.\"\"\"\n    metadata = loads(get(\n        environ.get('LE_AUTO_JSON_URL',\n                    'https://pypi.python.org/pypi/certbot/json')))\n    # metadata['info']['version'] actually returns the latest of any kind of\n    # release release, contrary to https://wiki.python.org/moin/PyPIJSON.\n    # The regex is a sufficient regex for picking out prereleases for most\n    # packages, LE included.\n    return str(max(LooseVersion(r) for r\n                   in metadata['releases'].iterkeys()\n                   if re.match('^[0-9.]+$', r)))\n\n\ndef verified_new_le_auto(get, tag, temp_dir):\n    \"\"\"Return the path to a verified, up-to-date letsencrypt-auto script.\n\n    If the download's signature does not verify or something else goes wrong\n    with the verification process, raise ExpectedError.\n\n    \"\"\"\n    le_auto_dir = environ.get(\n        'LE_AUTO_DIR_TEMPLATE',\n        'https://raw.githubusercontent.com/certbot/certbot/%s/'\n        'letsencrypt-auto-source/') % tag\n    write(get(le_auto_dir + 'letsencrypt-auto'), temp_dir, 'letsencrypt-auto')\n    write(get(le_auto_dir + 'letsencrypt-auto.sig'), temp_dir, 'letsencrypt-auto.sig')\n    write(PUBLIC_KEY, temp_dir, 'public_key.pem')\n    try:\n        with open(devnull, 'w') as dev_null:\n            check_call(['openssl', 'dgst', '-sha256', '-verify',\n                        join(temp_dir, 'public_key.pem'),\n                        '-signature',\n                        join(temp_dir, 'letsencrypt-auto.sig'),\n                        join(temp_dir, 'letsencrypt-auto')],\n                       stdout=dev_null,\n                       stderr=dev_null)\n    except CalledProcessError as exc:\n        raise ExpectedError(\"Couldn't verify signature of downloaded \"\n                            \"certbot-auto.\", exc)\n\n\ndef main():\n    get = HttpsGetter().get\n    flag = argv[1]\n    try:\n        if flag == '--latest-version':\n            print(latest_stable_version(get))\n        elif flag == '--le-auto-script':\n            tag = argv[2]\n            verified_new_le_auto(get, tag, dirname(argv[0]))\n    except ExpectedError as exc:\n        print(exc.args[0], exc.args[1])\n        return 1\n    else:\n        return 0\n\n\nif __name__ == '__main__':\n    exit(main())\n", "path": "letsencrypt-auto-source/pieces/fetch.py"}], "after_files": [{"content": "\"\"\"Do downloading and JSON parsing without additional dependencies. ::\n\n    # Print latest released version of LE to stdout:\n    python fetch.py --latest-version\n\n    # Download letsencrypt-auto script from git tag v1.2.3 into the folder I'm\n    # in, and make sure its signature verifies:\n    python fetch.py --le-auto-script v1.2.3\n\nOn failure, return non-zero.\n\n\"\"\"\n\nfrom __future__ import print_function\n\nfrom distutils.version import LooseVersion\nfrom json import loads\nfrom os import devnull, environ\nfrom os.path import dirname, join\nimport re\nfrom subprocess import check_call, CalledProcessError\nfrom sys import argv, exit\nfrom urllib2 import build_opener, HTTPHandler, HTTPSHandler\nfrom urllib2 import HTTPError, URLError\n\nPUBLIC_KEY = environ.get('LE_AUTO_PUBLIC_KEY', \"\"\"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6MR8W/galdxnpGqBsYbq\nOzQb2eyW15YFjDDEMI0ZOzt8f504obNs920lDnpPD2/KqgsfjOgw2K7xWDJIj/18\nxUvWPk3LDkrnokNiRkA3KOx3W6fHycKL+zID7zy+xZYBuh2fLyQtWV1VGQ45iNRp\n9+Zo7rH86cdfgkdnWTlNSHyTLW9NbXvyv/E12bppPcEvgCTAQXgnDVJ0/sqmeiij\nn9tTFh03aM+R2V/21h8aTraAS24qiPCz6gkmYGC8yr6mglcnNoYbsLNYZ69zF1XH\ncXPduCPdPdfLlzVlKK1/U7hkA28eG3BIAMh6uJYBRJTpiGgaGdPd7YekUB8S6cy+\nCQIDAQAB\n-----END PUBLIC KEY-----\n\"\"\")\n\nclass ExpectedError(Exception):\n    \"\"\"A novice-readable exception that also carries the original exception for\n    debugging\"\"\"\n\n\nclass HttpsGetter(object):\n    def __init__(self):\n        \"\"\"Build an HTTPS opener.\"\"\"\n        # Based on pip 1.4.1's URLOpener\n        # This verifies certs on only Python >=2.7.9.\n        self._opener = build_opener(HTTPSHandler())\n        # Strip out HTTPHandler to prevent MITM spoof:\n        for handler in self._opener.handlers:\n            if isinstance(handler, HTTPHandler):\n                self._opener.handlers.remove(handler)\n\n    def get(self, url):\n        \"\"\"Return the document contents pointed to by an HTTPS URL.\n\n        If something goes wrong (404, timeout, etc.), raise ExpectedError.\n\n        \"\"\"\n        try:\n            # socket module docs say default timeout is None: that is, no\n            # timeout\n            return self._opener.open(url, timeout=30).read()\n        except (HTTPError, IOError) as exc:\n            raise ExpectedError(\"Couldn't download %s.\" % url, exc)\n\n\ndef write(contents, dir, filename):\n    \"\"\"Write something to a file in a certain directory.\"\"\"\n    with open(join(dir, filename), 'w') as file:\n        file.write(contents)\n\n\ndef latest_stable_version(get):\n    \"\"\"Return the latest stable release of letsencrypt.\"\"\"\n    metadata = loads(get(\n        environ.get('LE_AUTO_JSON_URL',\n                    'https://pypi.python.org/pypi/certbot/json')))\n    # metadata['info']['version'] actually returns the latest of any kind of\n    # release release, contrary to https://wiki.python.org/moin/PyPIJSON.\n    # The regex is a sufficient regex for picking out prereleases for most\n    # packages, LE included.\n    return str(max(LooseVersion(r) for r\n                   in metadata['releases'].iterkeys()\n                   if re.match('^[0-9.]+$', r)))\n\n\ndef verified_new_le_auto(get, tag, temp_dir):\n    \"\"\"Return the path to a verified, up-to-date letsencrypt-auto script.\n\n    If the download's signature does not verify or something else goes wrong\n    with the verification process, raise ExpectedError.\n\n    \"\"\"\n    le_auto_dir = environ.get(\n        'LE_AUTO_DIR_TEMPLATE',\n        'https://raw.githubusercontent.com/certbot/certbot/%s/'\n        'letsencrypt-auto-source/') % tag\n    write(get(le_auto_dir + 'letsencrypt-auto'), temp_dir, 'letsencrypt-auto')\n    write(get(le_auto_dir + 'letsencrypt-auto.sig'), temp_dir, 'letsencrypt-auto.sig')\n    write(PUBLIC_KEY, temp_dir, 'public_key.pem')\n    try:\n        with open(devnull, 'w') as dev_null:\n            check_call(['openssl', 'dgst', '-sha256', '-verify',\n                        join(temp_dir, 'public_key.pem'),\n                        '-signature',\n                        join(temp_dir, 'letsencrypt-auto.sig'),\n                        join(temp_dir, 'letsencrypt-auto')],\n                       stdout=dev_null,\n                       stderr=dev_null)\n    except CalledProcessError as exc:\n        raise ExpectedError(\"Couldn't verify signature of downloaded \"\n                            \"certbot-auto.\", exc)\n\n\ndef main():\n    get = HttpsGetter().get\n    flag = argv[1]\n    try:\n        if flag == '--latest-version':\n            print(latest_stable_version(get))\n        elif flag == '--le-auto-script':\n            tag = argv[2]\n            verified_new_le_auto(get, tag, dirname(argv[0]))\n    except ExpectedError as exc:\n        print(exc.args[0], exc.args[1])\n        return 1\n    else:\n        return 0\n\n\nif __name__ == '__main__':\n    exit(main())\n", "path": "letsencrypt-auto-source/pieces/fetch.py"}]}