Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
InsecurePlatformWarning using requests on https website
-
Hi everyone,
I am trying to set up a connection to a https website using requests with the following:import requests ... requests.get(url)
When I try to run my script, I receive an error 14077438 (from _ssl.c:504). And if I look at the console, the following error appears: "InsecurePlatformWarning xxx.../urllib3/util/ssl_.py:122: A true SSLContext is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning"
I have installed 3 additional pip packages through stash as read on this page: https://stackoverflow.com/questions/18578439/using-requests-with-tls-doesnt-give-sni-support/18579484#18579484 but no luck...
Packages:
pyOpenSSL
ndg-httpsclient
pyasn1Any idea if it is possible to fix this issue in Pythonista2?
Thanks a lotBenoit
-
I've had this issue before and it disappeared after I reset the app' data. My guess is that I accidentally installed requests as a dependency locally, overriding the built-in version. Worth a shot to try a pip uninstall of requests in stash.
-
Thanks for the reply. I have removed requests from stash but no luck, it is still failing.
Although it is working with the Beta of Pythonista 3, using python 3.
-
Make sure that you fully quit and relaunch Pythonista after removing the module.
What do you get when you:
import requests, ssl print(requests.__version__) print(ssl.OPENSSL_VERSION)
-
hmm, why are you seeing a urllib3 error in pythonista 2!
maybe check what you have in pythinista2's site packages. -
Urllib3 is embedded inside of
requests.packages
on both Python 2 and Python 3... The following post is 5 years old but shows why the Requests author thought that urllib3 was the stepping stone to nirvana http://www.kennethreitz.org/essays/major-progress-for-requests -
@JonB
urllib3
is not the Python 3 version ofurllib2
. It's an independent third-party module. The Python 3urllib
module consists of what was underurllib
,urllib2
andurlparse
under Python 2. -
You can also
requests.packages.urllib3.disable_warnings()
to silence these warnings. -
At some point I started getting insecure platform warnings when requests was upgraded in Pythonista many many builds ago.
-
@Tizzy This was reported in the Pythonista v1.6 beta timeframe https://forum.omz-software.com/topic/1782/beta-status-update/49 and then you wrote: https://forum.omz-software.com/topic/1782/beta-status-update/91 and @omz responds a few posts down from your post.
These are just warnings, not halting errors and you can suppress them as described above.
-
No luck even after closing Pythonista 2.
My current versions are:
requests - 2.5.1
OpenSSL - 1.0.1g 7 Apr 2014