omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    ssl requests https urllib3
    6
    11
    9682
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • camfrout
      camfrout last edited by

      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
      pyasn1

      Any idea if it is possible to fix this issue in Pythonista2?
      Thanks a lot

      Benoit

      1 Reply Last reply Reply Quote 0
      • yellinben
        yellinben last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • camfrout
          camfrout last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • ccc
            ccc last edited by ccc

            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)
            
            1 Reply Last reply Reply Quote 0
            • JonB
              JonB last edited by

              hmm, why are you seeing a urllib3 error in pythonista 2!
              maybe check what you have in pythinista2's site packages.

              1 Reply Last reply Reply Quote 0
              • ccc
                ccc last edited by ccc

                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

                1 Reply Last reply Reply Quote 0
                • dgelessus
                  dgelessus last edited by

                  @JonB urllib3 is not the Python 3 version of urllib2. It's an independent third-party module. The Python 3 urllib module consists of what was under urllib, urllib2 and urlparse under Python 2.

                  1 Reply Last reply Reply Quote 0
                  • ccc
                    ccc last edited by

                    You can also requests.packages.urllib3.disable_warnings() to silence these warnings.

                    1 Reply Last reply Reply Quote 0
                    • Tizzy
                      Tizzy last edited by

                      At some point I started getting insecure platform warnings when requests was upgraded in Pythonista many many builds ago.

                      1 Reply Last reply Reply Quote 0
                      • ccc
                        ccc last edited by ccc

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

                        1 Reply Last reply Reply Quote 0
                        • camfrout
                          camfrout last edited by

                          No luck even after closing Pythonista 2.

                          My current versions are:
                          requests - 2.5.1
                          OpenSSL - 1.0.1g 7 Apr 2014

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Powered by NodeBB Forums | Contributors