Kivy中的HTTPS请求 [英] HTTPS Request in Kivy

查看:131
本文介绍了Kivy中的HTTPS请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在与通过AWS API Gateway托管的API绑定的Kivy应用程序中,我一直在努力处理HTTPS请求.首先,我从Python3移至2,然后从请求库移至kivy的URLRequest.

I've been struggling with HTTPS requests in a Kivy app tied to an API hosted through AWS API Gateway. First, I moved from Python3 to 2 and then from the requests library to kivy's URLRequest.

该应用程序在我的Linux桌面上可以正常运行.当我使用请求库发出API请求时,我收到一个SSL错误:SSL23_GET_SERVER_HELLO:sslv3警报握手失败

The app works fine on my linux desktop. When I made the API request with the requests library I got an SSL error: SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

我转而使用URLRequest,它似乎与请求具有相同的SSL错误.传递到URLRequest错误回调的参数为:(,SSLError(1,'_ssl.c:503:错误:14077410:SSL例程:SSL23_GET_SERVER_HELLO:sslv3警报握手失败'))

I moved to using URLRequest, which seems to be having the same SSL error as requests was. Arguments passed into the URLRequest error callback are: (, SSLError(1, '_ssl.c:503: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure'))

我发现了这个stackoverflow问题: SSL23_GET_SERVER_HELLO:sslv3警报握手失败[猕猴桃]

I found this stackoverflow question: SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure [Kivy]

这暗示这与过时的python版本有关.

Which implies this has to do with outdated python versions.

是否只是Kivy android应用程序无法与AWS API Gateway通信?

Is it just a Kivy android app is incapable of communicating with an AWS API Gateway?

Buildozer .spec行: 需求= hostpython2,kivy,future,python-dateutil,openssl,pyopenssl,jmespath,botocore,boto3,请求

Buildozer .spec lines: requirements = hostpython2, kivy, future, python-dateutil, openssl, pyopenssl, jmespath, botocore, boto3, requests

android.permissions =互联网

android.permissions = INTERNET

更新:我测试了URL为 https://kivy的HTTPS GET请求.org/logos/kivy-logo-black-64.png .这已在Android App中成功完成.此问题似乎特定于AWS API Gateway使用的SSL版本

UPDATE: I tested a HTTPS GET request with the URL https://kivy.org/logos/kivy-logo-black-64.png. This completed successfully in the Android App. This problem seems to be specific to the SSL version used by AWS API Gateway

UPDATE2:Android上的Kivy也可以与Google Cloud Platform的云功能HTTPS端点配合使用.甚至有更多证据表明此问题与AWS API Gateway密切相关.

UPDATE2: Kivy on Android also works fine with Google Cloud Platform's cloud functions HTTPS endpoints. Even more evidence this issue is specifically tied to AWS API Gateway.

推荐答案

请确保您的.spec文件具有Internet权限.我也相信,如果您使用的是python2,则需要在您的需求中使用"hostpython2".我不确定您是否有依赖于python 2或3的任何要求,但是如果您使用的是python,请确保它们适用于python 2.另外,我认为您的请求要求中不需要[安全性].尝试仅放置请求",您也可以尝试安装sqlite并将g添加到您的需求中.

Make sure your .spec file has internet permissions. Also I believe you need 'hostpython2' in your requirements if you are using python2. Im not sure if any of the requirements you have in there are python 2 or 3 dependent but make sure they work for python 2 if that's what your using. Also I dont think you need the [security] in your requests requirement. Try just putting 'requests' also u might try installing sqlite and adding g that into your requirements as well.

这篇关于Kivy中的HTTPS请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆