30
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

【python3】python3系でurllibのエラーが出た時の対処

Last updated at Posted at 2019-04-08

pythonでスクレイピングをやろうと思い立った。
そこでurllibを使ったがssl関連でエラーにブチ当たってしまった。

おとなしくurllib3使うべきだろうが、
すぐに解決できたのでその対処法を残す。

エラーにぶち当たったコードはコレ

stringControl.go

package main
import (

)

func main() {
	fmt.Println("Hello, playground")
	s := "Alfa Bravo Charlie Delta Echo Foxtrot Golf"
 	fmt.Println(strings.Index(s, "Delta")) 
	tg := "F"
	fmt.Println(strings.Index(s, tg)) 
	
	strings.Replace(s, "A", "Z", 1)
	fmt.Println(s)
	
	t := "hogehogehogehoge"
	p := strings.Replace(t, "ge", "ji", 1)
	fmt.Println(p)	
	
	at := [18 29 31 37 44 48 55 69 72 78 90]
	
	
}



<エラー内容 一部省略>

urllib.error.URLError:
 <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED]
certificate verify failed:
unable to get local issuer certificate (_ssl.c:1045)>

対象方法は下記のどちらかをシェルで実行するだけ。

pip install --upgrade certifi

それでもだめなら、、、

open /Applications/Python\ 3.6/Install\ Certificates.command

※ Pythonのバージョンを合わせることが必要! 


参考サイトは
Fixing CERTIFICATE_VERIFY_FAILED error when trying requests-html out on Mac


30
15
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
30
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?