From c813efdce7a69d6510b8ea2a1b69d351fc983d09 Mon Sep 17 00:00:00 2001 From: Jakub Warmuz Date: Thu, 28 May 2015 18:07:49 +0000 Subject: [PATCH] Merge obtain_certificate and _obtain_certificate --- letsencrypt/client.py | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/letsencrypt/client.py b/letsencrypt/client.py index f874efd9c..b64f3b542 100644 --- a/letsencrypt/client.py +++ b/letsencrypt/client.py @@ -100,12 +100,12 @@ class Client(object): self.account.save() - def _obtain_certificate(self, domains, csr=None): + def obtain_certificate(self, domains, csr=None): """Obtains a certificate from the ACME server. :meth:`.register` must be called before :meth:`.obtain_certificate` - .. todo:: This function does not currently handle csr correctly... + .. todo:: This function does not currently handle CSR correctly. :param set domains: domains to get a certificate @@ -113,8 +113,9 @@ class Client(object): this CSR can be different than self.authkey :type csr: :class:`CSR` - :returns: cert_pem, key_pem, chain_pem - :rtype: `tuple` of (str, str, str) + :returns: Certificate, private key, and certificate chain (all + PEM-encoded). + :rtype: `tuple` of `str` """ if self.auth_handler is None: @@ -179,24 +180,13 @@ class Client(object): not be obtained. """ - cert_pem, privkey, chain_pem = self._obtain_certificate(domains, csr) + cert, privkey, chain = self.obtain_certificate(domains, csr) self.config.namespace.authenticator = plugins.find_init( authenticator).name if installer is not None: self.config.namespace.installer = plugins.find_init(installer).name - return storage.RenewableCert.new_lineage(domains[0], cert_pem, - privkey, chain_pem, - vars(self.config.namespace)) - - def obtain_certificate(self, domains): - """Obtain certificate. - - Public method to obtain a certificate for the specified domains - using this client object. Returns the tuple (cert, privkey, - chain). - - """ - return self._obtain_certificate(domains, None) + return storage.RenewableCert.new_lineage( + domains[0], cert, privkey, chain, vars(self.config.namespace)) def save_certificate(self, certr, cert_path, chain_path): # pylint: disable=no-self-use