urllib cannot read https

后端 未结 4 652
温柔的废话
温柔的废话 2020-12-10 05:35

(Python 3.4.2) Would anyone be able to help me fetch https pages with urllib? I\'ve spent hours trying to figure this out.

Here\'s what I\'m trying to do (pretty bas

4条回答
  •  [愿得一人]
    2020-12-10 06:01

    this may help

    Ignore SSL certificate errors

    ctx = ssl.create_default_context()
    ctx.check_hostname = False
    ctx.verify_mode = ssl.CERT_NONE
    
    url = input('Enter - ')
    html = urllib.request.urlopen(url, context=ctx).read()
    

提交回复
热议问题