HTTPS Request in Kivy

青春壹個敷衍的年華 提交于 2019-12-22 05:42:13

问题


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.

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

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'))

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

Which implies this has to do with outdated python versions.

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

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

android.permissions = INTERNET

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: 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.


回答1:


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.



来源:https://stackoverflow.com/questions/52482148/https-request-in-kivy

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!