python 调用dnspod接口修改A记录

import requests

ip = requests.get('https://api.ipify.org/')
print(ip.text)


def update_ip(record_id):
    url = "https://dnsapi.cn/Record.Modify"
    data = {
        "login_token": "xxx",
        "format": "json",
        "domain": "xx.com",
        "record_id": record_id,
        "value": ip,
        "record_type": "A",
        "record_line_id": "10=1"
    }
    response = requests.post(url, data=data)
    print(response.text.encode('utf-8').decode('unicode_escape'))


# oms100
update_ip(7805156)
# oms
update_ip(378047661)

posted on 2023-07-10 11:30  隨風.NET  阅读(51)  评论(0编辑  收藏  举报

导航