xudaolong / CodeVar

生成可用的代码变量 (CodeVar that return u a better variable from Chinese to English . )
1.13k stars 84 forks source link

fix: 有道云api失效问题 #37

Open liuarui opened 1 year ago

liuarui commented 1 year ago
  1. 修复有道云失效
  2. 添加环境变量方式
lowking commented 1 year ago

依然不行,请求参数:

{
    "query":
    {
        "q": "c",
        "from": "zh-CHS",
        "to": "en",
        "appKey": "14c480aa0dxxxxxx",
        "salt": 1692783427503,
        "sign": "af858eebfa6f6077a955bd1a54a16dc8a481fbeb95300f9eb85b97ce66c459da",
        "signType": "v3",
        "curtime": 1692783428
    }
}

返回结果:

{
  "requestId": "b973b6f3-1e8c-4e15-a1e8-a4236737452e",
  "errorCode": "101",
  "l": "null2null"
}

101,文档里面意思是参数不全,但是看了api必填就上面8个参数,不知道哪里问题了 有没有可能请求的方式问题,导致有道接收不到参数呢

lowking commented 1 year ago

今天看了下alfy源码,我把请求体的query改成body就可以了,不知道为撒用query发送get不行,用body发送post就可以。有道官网写着method,get/post都可以。这是设置body之后,afly使用got构建post请求的逻辑: image