mirror of
https://github.com/certbot/certbot.git
synced 2026-06-05 06:42:10 -04:00
misc fixes
This commit is contained in:
parent
700a1428c2
commit
95a052f0ac
3 changed files with 6 additions and 11 deletions
|
|
@ -3,10 +3,10 @@ from __future__ import print_function
|
|||
|
||||
import collections
|
||||
import logging
|
||||
import queue
|
||||
import sys
|
||||
import textwrap
|
||||
|
||||
from six.moves import queue # type: ignore
|
||||
import zope.interface
|
||||
|
||||
from certbot import interfaces
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ def make_key(bits=1024, key_type="rsa", elliptic_curve=None):
|
|||
except TypeError:
|
||||
raise errors.Error("Unsupported elliptic curve: {}".format(elliptic_curve))
|
||||
except UnsupportedAlgorithm as e:
|
||||
raise six.raise_from(e, errors.Error(str(e)))
|
||||
raise e from errors.Error(str(e))
|
||||
_key_pem = _key.private_bytes(
|
||||
encoding=Encoding.PEM,
|
||||
format=PrivateFormat.TraditionalOpenSSL,
|
||||
|
|
@ -491,14 +491,9 @@ def _notAfterBefore(cert_path, method):
|
|||
reformatted_timestamp = [timestamp[0:4], b"-", timestamp[4:6], b"-",
|
||||
timestamp[6:8], b"T", timestamp[8:10], b":",
|
||||
timestamp[10:12], b":", timestamp[12:]]
|
||||
# pyrfc3339 always uses the type `str`. This means that in Python 2, it
|
||||
# expects str/bytes and in Python 3 it expects its str type or the Python 2
|
||||
# equivalent of the type unicode.
|
||||
# pyrfc3339 always uses the type `str`
|
||||
timestamp_bytes = b"".join(reformatted_timestamp)
|
||||
if six.PY3:
|
||||
timestamp_str = timestamp_bytes.decode('ascii')
|
||||
else:
|
||||
timestamp_str = timestamp_bytes
|
||||
timestamp_str = timestamp_bytes.decode('ascii')
|
||||
return pyrfc3339.parse(timestamp_str)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ def _wrap_lines(msg):
|
|||
def input_with_timeout(prompt=None, timeout=36000.0):
|
||||
"""Get user input with a timeout.
|
||||
|
||||
Behaves the same as six.moves.input, however, an error is raised if
|
||||
Behaves the same as the builtin input, however, an error is raised if
|
||||
a user doesn't answer after timeout seconds. The default timeout
|
||||
value was chosen to place it just under 12 hours for users following
|
||||
our advice and running Certbot twice a day.
|
||||
|
|
@ -85,7 +85,7 @@ def input_with_timeout(prompt=None, timeout=36000.0):
|
|||
:raises errors.Error if no answer is given before the timeout
|
||||
|
||||
"""
|
||||
# use of sys.stdin and sys.stdout to mimic six.moves.input based on
|
||||
# use of sys.stdin and sys.stdout to mimic the builtin input based on
|
||||
# https://github.com/python/cpython/blob/baf7bb30a02aabde260143136bdf5b3738a1d409/Lib/getpass.py#L129
|
||||
if prompt:
|
||||
sys.stdout.write(prompt)
|
||||
|
|
|
|||
Loading…
Reference in a new issue