域名每年价格是指注册一个域名时,每年需要支付的费用。域名是互联网上用于识别和定位网站的地址,例如www.example.com。域名的价格因后缀(如.com、.net、.org等)、注册年限、注册商和市场需求等因素而异。
以下是一个简单的Python脚本,用于查询域名的价格:
import requests
def get_domain_price(domain, extension):
url = f"https://api.domainr.com/v2/search?q={domain}+{extension}&client_id=YOUR_CLIENT_ID"
response = requests.get(url)
data = response.json()
if 'results' in data and len(data['results']) > 0:
return data['results'][0]['price']
else:
return "Domain not found"
domain = "example"
extension = "com"
price = get_domain_price(domain, extension)
print(f"The price for {domain}.{extension} is {price}")
请注意,以上代码中的YOUR_CLIENT_ID
需要替换为你在相应API服务提供商处获取的实际客户端ID。