在客户端主机上实现acme dns客户端通信和永久帐户存储的库
pyacmedns的Python项目详细描述
用于处理acme-dns客户端通信和永久帐户存储的客户端库。
安装
从pypi安装
$ pip install pyacmedns
用法
下面是使用此库处理验证的完整示例。
#!/usr/bin/env pythonfrompyacmednsimportClient,Storagewhitelisted_networks=["192.168.11.0/24","[::1]/128"]domain="your.example.org"# Initialize the client. Point it towards your acme-dns instance.client=Client("https://auth.acme-dns.io")# Initialize the storage. If the file does not exist, it will be# automatically created.storage=Storage("/path/to/storage.json")# Check if credentials were previously saved for your domainaccount=storage.fetch("your.example.org")ifnotaccount:# Account did not exist. Let's create a new one# The whitelisted networks parameter is optionalaccount=client.register_account(whitelisted_networks)# Save itstorage.put(domain,account)storage.save()# Update the acme-dns TXT record.client.update_txt_record(account,"___validation_token_recieved_from_the_ca___")