Python - API Godaddy 问题响应 [422]

问题描述

美好的一天!

我正在尝试向 Godaddy 的 API 创建请求并收到错误

{"code":"INVALID_BODY","message":"Request body doesn't fulfill schema,see details in `fields`"}

<Response [422]>

我试过了:

  1. 更改日期时间格式
  2. 更改电话格式
  3. 更改名称服务器列表
  4. 将 nameServer 行留空
  5. 更改标题
  6. 无域
  7. 更改传真线路(“”、“”、“+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","state": "Vinnytsia Oblast"
          },"organization": "SEM Experts","contactRegistrant": {
          "addressMailing": {
            "address1": "1 May 520/2","contactTech": {
          "addressMailing": {
            "address1": "1 May 520/2","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()

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)