python - 无法将 react-native 应用程序(博览会)与烧瓶服务器连接
问题描述
我正在尝试将我的 expo-app 与烧瓶服务器连接
这是请求
fetch("127.0.0.1:5000/post", {
method: 'POST',
body: {
'base64' : photoData["base64"]
},
})
.then(response => response.json())
.then(result => {
console.log("******************\nRESULT");
console.log(result);
})
.catch(err => { console.log(err); })
在服务器端。我已经尝试使用邮递员发送请求并且一切正常。
@app.route('/post', methods=['Post'])
def webhook():
file = request.args['base64']
rv = base64.b64encode(str.encode(file)) # bytes
rv = rv.decode('ascii') # str
return rv
这是我在世博会上遇到的错误
Network request failed
- node_modules\whatwg-fetch\dist\fetch.umd.js:535:17 in setTimeout$argument_0
- node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
- node_modules\react-native\Libraries\Core\Timers\JSTimers.js:383:16 in callTimers
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:416:4 in __callFunction
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:109:6 in __guard$argument_0
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
- node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:108:4 in callFunctionReturnFlushedQueue
* [native code]:null in callFunctionReturnFlushedQueue
有谁知道解决方案?
解决方案
推荐阅读
- javascript - 带有 pdf-lib 的“无法嵌入缺少内容的页面”
- python - python中的类变量使用Pyglet
- azure-cognitive-search - 翻译技能不将字段写入输出
- python-3.x - pip3 在我的路径中,但是当我尝试运行它时它失败了
- c - 如何在代码中打印退出状态?
- python - 如何更新此 Bokeh ColumnDataSource?
- three.js - 如何让 Dashed THREE.MeshLine 工作?
- xml - 从大型 xml 文件中删除节点的平台无关的 powershell 方法是什么?
- macos - macOS 如何通过捆绑标识符定位应用程序?
- javascript - 使 D3 图上的轴线消失