python-3.x - 使用 Flask-restful 创建 GET 函数但出现以下错误:[requests.exceptions.SSLError] [SSL: WRONG_VERSION_NUMBER]
问题描述
我目前正在开发一个使用 Flask-restful 的函数来调用一个从另一个站点获取二维码的 GET 函数。但出现以下错误:
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 设置任何配置才能使其工作?非常感谢。
解决方案
确保浏览器中的“http://”和请求 URL 参数相同。如果不让它成为您在浏览器中看到的那个。让我知道这是否对您有帮助。
推荐阅读
- linux - 从文本中 bash grep 字符串并发送电子邮件
- python - 如何从字典中删除重复的键值
- mysql - 数据库表的命名决策
- python - 为什么相同的python代码有不同的时钟时间?
- apache-kafka - 在 Kafka 集群中添加新的 ZooKeeper 节点?
- multithreading - 如何在 Julia 中杀死任务?
- javascript - React:更新子组件而不重新渲染父组件
- shell - 获取目录中选定的扩展文件数量和大小
- c# - XmlSerializer 不反序列化列表
- python - 执行删除,sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) 靠近“,”,而我