httpx.request成功了,收不到返回数据?
发布于 5 年前 作者 wwang 4582 次浏览 来自 问答

用的阿里云sdk,网络里可以看到成功收到服务器的数据了,但是代码超时报错,收不到数据

const Core = require('[@alicloud](/user/alicloud)/pop-core');

var client = new Core({
  accessKeyId: '<accessKeyId>',
  accessKeySecret: '<accessSecret>',
  endpoint: 'https://iot.cn-shanghai.aliyuncs.com',
  apiVersion: '2018-01-20'
});

var params = {
  "RegionId": "cn-shanghai",
  "ProductKey": "xxxxxxxxx",
  "DeviceName": "xxxxxx"
}

var requestOption = {
  method: 'POST'
};

client.request('GetDeviceStatus', params, requestOption).then((result) => {
  console.log(JSON.stringify(result));
}, (ex) => {
  console.log(ex);
})

回到顶部