urllib HTTPS request:

后端 未结 5 2028
太阳男子
太阳男子 2020-12-01 16:30

I have a script on python3.4 and it has been fine until the website I download the file from decides to use https and now I am getting error but can\'t figure out how I can

相关标签:
5条回答
  • 2020-12-01 17:03

    for HTTP
    people who encountered the error ValueError: unknown url type: 'http or ValueError: unknown url type: b'http

    while opening some url like below with urllib.request.Request 'http://localhost/simple_form/insert.php'

    just change localhost to 127.0.0.1

    looks like Request method is looking for a domain.something in url

    0 讨论(0)
  • 2020-12-01 17:15

    Most likely your Python installation or operating system is broken.

    Python has only support for HTTPS if it was compiled with HTTPS support. However, this should be the default for all sane installations.

    HTTPS support is only available if the socket module was compiled with SSL support.
    

    https://docs.python.org/3/library/http.client.html

    Please clarify how you installed Python. Official Python distributions are available at python.org

    0 讨论(0)
  • 2020-12-01 17:20

    Had this issue, and it was solved by upgrading Python with

    brew upgrade python
    
    0 讨论(0)
  • 2020-12-01 17:23

    I had the same problem with Anaconda but after installing the OpenSSL package, it works well.

    conda install -c anaconda openssl
    
    0 讨论(0)
  • 2020-12-01 17:23

    For me the error was resolved by downloading the correct version of openssl.

    I was using python 3.7.5 32 bit version on windows 10 machine.

    1. goto https://slproweb.com/products/Win32OpenSSL.html and download Win32 OpenSSL v1.1.1h EXE | MSI 54MB Installer version . I used 32 bit as my python interpreter was 32 bit.

    2. Install and run.

    Issue fixed :)

    0 讨论(0)
提交回复
热议问题