【问题标题】:Using Flask-restful to make a GET function but got the following error : [requests.exceptions.SSLError] [SSL: WRONG_VERSION_NUMBER]使用 Flask-restful 创建 GET 函数但出现以下错误:[requests.exceptions.SSLError] [SSL: WRONG_VERSION_NUMBER]
【发布时间】:2020-12-24 05:02:30
【问题描述】:

我目前正在开发一个使用 Flask-restful 的函数来调用 GET 函数以从另一个站点获取 QR 码。但出现以下错误:

requests.exceptions.SSLError: HTTPSConnectionPool(host='testing-site', port=443): url: /testing/getQR?clientID={clientID}&responseType={response-type}&source=PC_Browser&redirectURI ={redirect-url} (由 SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] 错误版本号 (_ssl.c:1122)')))

我的代码如下:

qr_request_body_web = {'clientID' : clientID, 'responseType' : 'code', 'source' : 'PC_Browser', 'redirectURI' : server_domain + authcallback_path}

def getQR():
response = requests.get('testing-site' + api_auth_getqr_path, params = qr_request_body_web, allow_redirects=True)
return redirect(response.url)

if __name__ == '__main__':
app.run(port=80, debug=True)

我可以在 Postman & Chrome 上调用 GET 函数,是否需要为 python 设置任何配置才能使其工作?非常感谢。

【问题讨论】:

    标签: python-3.x flask openssl flask-restful restful-url


    【解决方案1】:

    确保浏览器中的“http://”与请求 URL 参数相同。如果不让它成为您在浏览器中看到的那个。让我知道这是否对您有帮助。

    【讨论】:

    • 如果您可以提供包含您建议的更正的代码,则答案可以增加更多价值。
    猜你喜欢
    • 2021-05-05
    • 1970-01-01
    • 2015-03-17
    • 1970-01-01
    • 2010-10-24
    • 2017-08-02
    • 2014-11-04
    • 2020-06-08
    • 1970-01-01
    相关资源
    最近更新 更多