質問編集履歴

3

全体のStackTraceを追加

2021/01/06 16:44

投稿

nakamiri
nakamiri

スコア7

test CHANGED
File without changes
test CHANGED
@@ -22,6 +22,80 @@
22
22
 
23
23
 
24
24
 
25
+ ```
26
+
27
+ (sample-slackbot) nakamiri@ITPC00603:~/work/sample-slackbot$ CURL_CA_BUNDLE="" python run.py
28
+
29
+ start slackbot
30
+
31
+ /home/nakamiri/.local/share/virtualenvs/sample-slackbot-YXuvx29z/lib/python3.9/site-packages/urllib3/connectionpool.py:1013: InsecureRequestWarning: Unverified HTTPS request is being made to host 'slack.com'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
32
+
33
+ warnings.warn(
34
+
35
+ Traceback (most recent call last):
36
+
37
+ File "/home/nakamiri/work/sample-slackbot/run.py", line 19, in <module>
38
+
39
+ main()
40
+
41
+ File "/home/nakamiri/work/sample-slackbot/run.py", line 13, in main
42
+
43
+ bot = Bot()
44
+
45
+ File "/home/nakamiri/.local/share/virtualenvs/sample-slackbot-YXuvx29z/lib/python3.9/site-packages/slackbot/bot.py", line 20, in __init__
46
+
47
+ self._client = SlackClient(
48
+
49
+ File "/home/nakamiri/.local/share/virtualenvs/sample-slackbot-YXuvx29z/lib/python3.9/site-packages/slackbot/slackclient.py", line 43, in __init__
50
+
51
+ self.rtm_connect()
52
+
53
+ File "/home/nakamiri/.local/share/virtualenvs/sample-slackbot-YXuvx29z/lib/python3.9/site-packages/slackbot/slackclient.py", line 48, in rtm_connect
54
+
55
+ self.parse_slack_login_data(reply)
56
+
57
+ File "/home/nakamiri/.local/share/virtualenvs/sample-slackbot-YXuvx29z/lib/python3.9/site-packages/slackbot/slackclient.py", line 71, in parse_slack_login_data
58
+
59
+ self.websocket = create_connection(self.login_data['url'], http_proxy_host=proxy,
60
+
61
+ File "/home/nakamiri/.local/share/virtualenvs/sample-slackbot-YXuvx29z/lib/python3.9/site-packages/websocket/_core.py", line 487, in create_connection
62
+
63
+ websock.connect(url, **options)
64
+
65
+ File "/home/nakamiri/.local/share/virtualenvs/sample-slackbot-YXuvx29z/lib/python3.9/site-packages/websocket/_core.py", line 210, in connect
66
+
67
+ self.sock, addrs = connect(url, self.sock_opt, proxy_info(**options),
68
+
69
+ File "/home/nakamiri/.local/share/virtualenvs/sample-slackbot-YXuvx29z/lib/python3.9/site-packages/websocket/_http.py", line 77, in connect
70
+
71
+ sock = _ssl_socket(sock, options.sslopt, hostname)
72
+
73
+ File "/home/nakamiri/.local/share/virtualenvs/sample-slackbot-YXuvx29z/lib/python3.9/site-packages/websocket/_http.py", line 182, in _ssl_socket
74
+
75
+ sock = _wrap_sni_socket(sock, sslopt, hostname, check_hostname)
76
+
77
+ File "/home/nakamiri/.local/share/virtualenvs/sample-slackbot-YXuvx29z/lib/python3.9/site-packages/websocket/_http.py", line 156, in _wrap_sni_socket
78
+
79
+ return context.wrap_socket(
80
+
81
+ File "/home/nakamiri/.pyenv/versions/3.9.1/lib/python3.9/ssl.py", line 500, in wrap_socket
82
+
83
+ return self.sslsocket_class._create(
84
+
85
+ File "/home/nakamiri/.pyenv/versions/3.9.1/lib/python3.9/ssl.py", line 1040, in _create
86
+
87
+ self.do_handshake()
88
+
89
+ File "/home/nakamiri/.pyenv/versions/3.9.1/lib/python3.9/ssl.py", line 1309, in do_handshake
90
+
91
+ self._sslobj.do_handshake()
92
+
93
+ ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1123)
94
+
95
+ ```
96
+
97
+
98
+
25
99
  # 環境
26
100
 
27
101
 

2

Win10でpip install時のエラー文を追加

2021/01/06 16:44

投稿

nakamiri
nakamiri

スコア7

test CHANGED
File without changes
test CHANGED
@@ -73,6 +73,46 @@
73
73
  * Python 3.9をインストーラでインストール
74
74
 
75
75
  * pip実行時に上記SSLエラーが発生したためWin10は一旦諦め、WSLで試すことに
76
+
77
+
78
+
79
+ ```pip実行時エラー
80
+
81
+ PS C:\Users****\Desktop> pip install pipenv
82
+
83
+ WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection
84
+
85
+ broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)'))': /simple/pipenv/
86
+
87
+ WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection
88
+
89
+ broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)'))': /simple/pipenv/
90
+
91
+ WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection
92
+
93
+ broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)'))': /simple/pipenv/
94
+
95
+ WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection
96
+
97
+ broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)'))': /simple/pipenv/
98
+
99
+ WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection
100
+
101
+ broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)'))': /simple/pipenv/
102
+
103
+ Could not fetch URL https://pypi.org/simple/pipenv/: There was a problem confirming the ssl certificate:
104
+
105
+ HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pipenv/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1122)'))) - skipping
106
+
107
+ ERROR: Could not find a version that satisfies the requirement pipenv (from versions: none)
108
+
109
+ ERROR: No matching distribution found for pipenv
110
+
111
+ Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed
112
+
113
+ certificate in certificate chain (_ssl.c:1122)'))) - skipping
114
+
115
+ ```
76
116
 
77
117
 
78
118
 

1

質問の趣旨が伝わりづらかったので、強調等の修正を加えました

2021/01/06 15:47

投稿

nakamiri
nakamiri

スコア7

test CHANGED
File without changes
test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- 透過型プロキシの環境下でPythonのライブラリを利用して外部とHTTPSでやり取りをしたいのですが、
5
+ 透過型プロキシの環境下でPythonのライブラリ(slackbot)を利用して外部とHTTPSでやり取りをしたいのですが、
6
6
 
7
7
  下記エラーが発生してしまうため無視もしくは証明書の指定をして外部と正常にHTTPS通信をできるようにしたいです。
8
8
 
@@ -34,7 +34,7 @@
34
34
 
35
35
  * Python 3.9
36
36
 
37
- * Slackbotを動かしたい
37
+ * **Slackbotを動かしたい**
38
38
 
39
39
  * 透過型プロキシが設置されたよくあるオフィスNW
40
40
 
@@ -54,7 +54,15 @@
54
54
 
55
55
 
56
56
 
57
+ ---
58
+
59
+
60
+
57
61
  # 試したこと
62
+
63
+
64
+
65
+ **ここから下は回答の参考になればと思い、色々試したことを記載しています**
58
66
 
59
67
 
60
68
 
@@ -142,4 +150,6 @@
142
150
 
143
151
 
144
152
 
145
- ここまでで、wget/curlは普通に実行できるが、Pythonのバイナリで実行されるHTTPS通信がエラーとなることを確認しました
153
+ ここまでで、wget/curlは普通に実行できるが、Pythonのバイナリで実行されるHTTPS通信がエラーとなることを確認
154
+
155
+ その上でslackbotを利用したBotアプリを作成して実行すると、同様にエラーが発生するため冒頭のSSLエラーの無視や解決方法を伺いたいです。