首页 > 解决方案 > 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)

标签: pythonjsonflask

解决方案


推荐阅读