python - Python - API Godaddy 问题(响应 [422])
问题描述
再会!
我正在尝试创建对 Godaddy 的 API 的请求并收到错误。
{"code":"INVALID_BODY","message":"Request body doesn't fulfill schema, see details in `fields`"}
<Response [422]>
我试过了:
- 更改日期时间格式
- 更改电话格式
- 更改名称服务器列表
- 将 nameServer 行留空
- 更改标题
- 免费域名
- 更改传真线路(“”、“”、“+380.931002784”、“+380.931002783”)不起作用。
这已经持续了超过 2 周,因为 godaddy 支持会在 70 小时内响应。
我将不胜感激。
API Godaddy https://developer.godaddy.com/doc/endpoint/domains#/v1/purchase
我的代码
import requests
import json
from datetime import datetime
def buy_domain():
api_key = "my key"
secret_key = "my key"
headers = {"Authorization": "sso-key {}:{}".format(api_key, secret_key), 'Accept': 'application/json'}
x=datetime.utcnow().isoformat()[:-3]+'Z'
print(x)
doma =json.dumps(
{
"consent": {
"agreedAt": "2021-04-27T22:56:01.31Z",
"agreedBy": "7.2.19.158",
"agreementKeys": ["DNRA"]
},
"contactAdmin": {
"addressMailing": {
"address1": "1 May 520/2",
"address2": "1 May 520/1",
"city": "Haysyn",
"country": "UA",
"postalCode": "23700",
"state": "Vinnytsia Oblast"
},
"email": "s.zor@gmail.com",
"fax": " ",
"jobTitle": "Owner",
"nameFirst": "Artem",
"nameLast": "Ivanov",
"nameMiddle": "Vitalevich",
"organization": "SE s",
"phone": "+380.931002784"
},
"contactBilling": {
"addressMailing": {
"address1": "1 May 520/2",
"address2": "1 May 520/1",
"city": "Haysyn",
"country": "UA",
"postalCode": "23700",
"state": "Vinnytsia Oblast"
},
"email": "s.zor@gmail.com",
"fax": " ",
"jobTitle": "Owner",
"nameFirst": "Artem",
"nameLast": "Ivanov",
"nameMiddle": "Vitalevich",
"organization": "SEM Experts",
"phone": "+380.931002784"
},
"contactRegistrant": {
"addressMailing": {
"address1": "1 May 520/2",
"address2": "1 May 520/1",
"city": "Haysyn",
"country": "UA",
"postalCode": "23700",
"state": "Vinnytsia Oblast"
},
"email": "s.zor@gmail.com",
"fax": " ",
"jobTitle": "Owner",
"nameFirst": "Artem",
"nameLast": "Ivanov",
"nameMiddle": "Vitalevich",
"organization": "SE s",
"phone": "+380.931002784"
},
"contactTech": {
"addressMailing": {
"address1": "1 May 520/2",
"address2": "1 May 520/1",
"city": "Haysyn",
"country": "UA",
"postalCode": "23700",
"state": "Vinnytsia Oblast"
},
"email": "s.zor@gmail.com",
"fax": " ",
"jobTitle": "Owner",
"nameFirst": "Artem",
"nameLast": "Ivanov",
"nameMiddle": "Vitalevich",
"organization": "SE s",
"phone": "+380.931002784"
},
"domain": "0000hwcp.com",
"nameServers": ["dns15.pointhq.com", "dns12.pointhq.com", "dns8.pointhq.com"],
"period": 1,
"privacy": False,
"renewAuto": True
})
print(doma, type(doma))
# url = "https://api.godaddy.com/v1/domains/purchase"
url='https://api.godaddy.com/v1/domains/purchase/validate'
availability_res = requests.post(url, json=doma, headers=headers)
print(headers)
print(availability_res.status_code)
print(availability_res.text)
print(availability_res)
buy_domain()
解决方案
推荐阅读
- node.js - 从 http.get 请求中检索错误消息
- c - 我在 C 中的宏做错了什么?
- xamarin.forms - Xamarin App 无法与具有标识列的 SQL Server DB 同步
- python - Python二分法
- python - 在毫秒时间戳上使用 pd.datetime() 很热门?
- android - 从 Firebase 获取数据后执行函数
- r - 如何从数据框中提取观察结果并制作显示观察结果、列名和行名的表格?
- reactjs - 如果 URL 在 React 中有特定的查询参数,如何渲染组件?
- sockets - 无法接受服务器上的套接字连接
- r - 如何直接渲染到包含 knit_expand 的 html rmd 文件