python - JSONDecodeError: Expecting value.. 在执行 HTTP GET 请求时
问题描述
我在尝试使用盛宝银行的 API 时遇到了很多问题。基本上我正在尝试实现 GET 请求,但是,我对 Web API 不是很熟悉。我没有得到数据,而是得到了这个错误:json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0). Below are my codes
from flask import Flask, render_template, request
import json
import requests
app = Flask(__name__)
@app.route('/api', methods=['GET'])
def temperature():
r = requests.get('https://gateway.saxobank.com/sim/openapi/port/v1/balances?AccountKey=Y8lhERGA9duVrD1IY-7cpA==&ClientKey=Y8lhERGA9duVrD1IY-7cpA==')
json_object = r.json()
return r.json(result)
if __name__ == '__main__':
app.run(debug=True)
解决方案
推荐阅读
- jquery - 实现:错误类型错误:$(...).datepicker 不是函数
- jenkins - 在 Jenkins Slave 中运行 Kaniko
- c# - Automapper Construct使用变化的值
- r - R:矩阵乘法错误 - 与 GLM 相关
- excel - 使用另一列中的条目搜索列?
- java - 添加 keyListener 来模拟鼠标点击链接,页面是用 Javax jspx servlet 制作的。getElementById 返回 null
- linux - 如何将处理器编号转换为 32 位十六进制值
- javascript - 如何禁用在textarea中添加电话号码?
- python - 查询集查找中的日期格式
- node.js - JSdom画布 - 如何截取页面截图?