[英]Error when downloading jpg using python result in: [SSL: CERTIFICATE_VERIFY_FAILED]
我一直在嘗試制作一個腳本,從特定類別抓取9gag和retreive帖子。 問題是當我嘗試下載jpg圖片時,出現證書問題。
還有其他下載圖片的方法嗎?
每張圖片的網址都可以這樣顯示:
https://img-9gag-fun.9cache.com/photo/aAgRxj0_460s.jpg https://img-9gag-fun.9cache.com/photo/aDgAx0N_460s.jpg
下載圖像的代碼:
def download(pictures, file_name, name):
for images in pictures['url_images']:
full_path = file_name + name + '.jpg'
urllib.request.urlretrieve(images, full_path)
呈現以下結果:
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1045)>
假設您使用python3和urllib3,請嘗試以下操作:
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
不知道這是否會幫助解決urllib時出現的ssl錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.