certbot / certbot

Certbot 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.
Other
31.12k stars 3.38k forks source link

'dict' object has no attribute 'newNonce' #9901

Open loopiajoakim opened 4 months ago

loopiajoakim commented 4 months ago

Hello,

I'm using a custom client with the acme library and since an upgrade 1.31.0,1 -> 2.4.0,1 (yes, a long time ago but still a problem) I sometimes get the following error: 'dict' object has no attribute 'newNonce'

This seems to originate from this function in acme/client.py

    def _post(self, *args: Any, **kwargs: Any) -> requests.Response:
        """Wrapper around self.net.post that adds the newNonce URL.

        This is used to retry the request in case of a badNonce error.

        """
        kwargs.setdefault('new_nonce_url', getattr(self.directory, 'newNonce'))
        return self.net.post(*args, **kwargs)

From changelog in version 2.0.0:

acme.messages.Directory now only supports lookups by the exact resource name string in the ACME directory (e.g. directory['newOrder']).

It looks like getattr on self.directory has been replaced in all other parts of this file. Using self.directory['newNonce'] seems to do the trick. Is this a forgotten function or am I simplifying things?