axios问题,请老师解答🤭
错误截图:
云函数movielist中index.js代码:
// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init({
env: cloud.DYNAMIC_CURRENT_ENV}) // 使用当前云环境
const axios = require('axios')
// 云函数入口函数
exports.main = async (event, context) => {
try {
const {
data
} = await axios({
url: `https://frodo.douban.com/api/v2/subject_collection/movie_showing/items?start=${event.start}&count=${event.count}&apiKey=054022eaeae0b00e0fc068c0c0a2102a`,
method: 'get',
headers: {
"Host": "frodo.douban.com",
"Connection": "keep-alive",
"content-type": "application/json",
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.2(0x18000236) NetType/WIFI Language/zh_CN',
'Referer': 'https://servicewechat.com/wx2f9b06c1de1ccfca/81/page-frame.html'
}
})
return data
} catch (e) {
console.log('捕获异常了.')
console.log(e)
}
}