通过dns api解析域名
1. Cloudflare dns api
curl -H "accept: application/dns-json" "https://1.1.1.1/dns-query?name=baidu.com"
import requests headers = {"accept": "application/dns-json"} r = requests.get("https://1.1.1.1/dns-query?name=baidu.com",headers=headers,verify=False) print(r.json())
2. google dns api
curl -H "accept: application/dns-json" "https://8.8.8.8/resolve?name=baidu.com"
import requests headers = {"accept": "application/dns-json"} r = requests.get("https://8.8.8.8/resolve?name=baidu.com",headers=headers,verify=False) print(r.json())