How do I scrape an https page? [duplicate]

送分小仙女□ 提交于 2019-12-07 18:48:59

问题


I'm using a python script with 'lxml' and 'requests' to scrape a web page. My goal is to grab an element from a page and download it, but the content is on an HTTPS page and I'm getting an error when trying to access the stuff in the page. I'm sure there is some kind of certificate or authentication I have to include, but I'm struggling to find the right resources. I'm using:

page = requests.get("https://[example-page.com]", auth=('[username]','[password]'))

and the error is:

requests.exceptions.SSLError: [Errno 185090050] _ssl.c:340: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib

回答1:


Adding verify=False to the GET request solves the issue.

page = requests.get("https://[example-page.com]", auth=('[username]','[password]'), verify=False)


来源:https://stackoverflow.com/questions/23416599/how-do-i-scrape-an-https-page

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!