community
community copied to clipboard
Use urlopen instead of build_opener when fetching files from 'internet'. Removes some PY2 compat.
Fixes issues:
- https://github.com/kivy/python-for-android/issues/1827 (Again,
SSL_CERT_FILE
workaround is not working anymore) - https://github.com/kivy/kivy/issues/6907 (Permanently)
- https://github.com/kivy/buildozer/issues/1502
Something changed on OpenSSL or on the Python ssl module , and the SSL_CERT_FILE
workaround is not working anymore.
- Now, instead of relying on
SSL_CERT_FILE
, an SSL context is created (we do something really similar onUrlRequest
). - Took the chance to remove some PY2 compat code
FYI (in a TL;DR version):
Really tried ( ~4h ) to find the root cause of the SSL_CERT_FILE
workaround failure (mostly for fun, as this patch looks cleaner), but without success.
ssl.get_default_verify_paths()
returns the correct cafile
when called, but ssl.create_default_context().get_ca_certs()
returns an empty list.
The best guess is that X509_STORE_set_default_paths
(of openssl) is silently failing on Android.
Will try to continue the investigation ...
Maintainer merge checklist
- [ ] Title is descriptive/clear for inclusion in release notes.
- [ ] Applied a
Component: xxx
label. - [ ] Applied the
api-deprecation
orapi-break
label. - [ ] Applied the
release-highlight
label to be highlighted in release notes. - [ ] Added to the milestone version it was merged into.
- [ ] Unittests are included in PR.
- [ ] Properly documented, including
versionadded
,versionchanged
as needed.
so what is the solution for this issue ?