I wonder which library for python3 I should use to generate a DNS token and then download the certificate. I have a function which updates the TXT record for my domain. I just need to have a library where I can can get the TXT record I should update to and also to download the cert. Hope you understand what I am getting at
Youβre looking for a Python library that implements the ACME protocol. Things are slightly more involved than retrieving a DNS record and downloading the certificate, though that is part of it.
Your best bet is probably the Python acme library - https://pypi.org/project/acme/ . However, it has the problem of having very out of date documentation.
I think maybe if you want an easy to use approach, you can just use Certbot in combination with a manual auth hook.