Cloudflare免费版控制台不给关IPv6,需要使用API关闭,先从我的个人资料里面申请API令牌,再执行脚本
import requests
import json
headers = {
'X-Auth-Email':'cloudflare@登入账户', #输入登入账户的邮箱
'X-Auth-Key': 'Global API Key', #输入上图申请的key
'Content-Type': 'application/json',
}
resp = requests.get('https://api.cloudflare.com/client/v4/zones?per_page=100&page=1',headers=headers) #域名太多 page设置翻页
data=json.loads(resp.text)
for domain in data["result"]:
print(f"区域ID:{domain['id']} 域名:{domain['name']}")
data='{"value":"off"}'
repr = requests.patch(f'https://api.cloudflare.com/client/v4/zones/{domain["id"]}/settings/ipv6',headers=headers,data=data)
print(repr.text)
刷新网页,所有站点 IPv6已关了