Skip to content

SSL Certification Error #325

Closed
Closed

Description

@LMPK

Description

I am following this guide here to try and build a simple bot: https://www.fullstackpython.com/blog/build-first-slack-bot-python.html

I have made it to the point where you actually run the code "python starterbot.py" and when I run the code I get a SSL certificate verify failed error. I will post the whole error messages at the bottom. I am not sure if it is an SSL error, or if it is because of the proxy I am behind since I am running it from my office computer.

I am running this on windows through the command prompt
Below is the messages I get when trying to run the code
python starterbot.py
Traceback (most recent call last):
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 595, in urlopen
self._prepare_proxy(conn)
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 816, in prepare_proxy
conn.connect()
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\connection.py", line 326, in connect
ssl_context=context)
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\util\ssl
.py", line 329, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\ssl.py", line 407, in wrap_socket
_context=self, _session=session)
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\ssl.py", line 814, in init
self.do_handshake()
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\ssl.py", line 1068, in do_handshake
self._sslobj.do_handshake()
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\ssl.py", line 689, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\adapters.py", line 440, in send
timeout=timeout
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\urllib3\util\retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='slack.com', port=443): Max retries exceeded with url: /api/rtm.connect (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\slackclient\client.py", line 52, in rtm_connect
self.server.rtm_connect(use_rtm_start=with_team_state, **kwargs)
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\slackclient\server.py", line 131, in rtm_connect
reply = self.api_requester.do(self.token, connect_method, timeout=timeout, post_data=kwargs)
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\slackclient\slackrequest.py", line 104, in do
proxies=self.proxies
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\api.py", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "C:\Users\n0342338\AppData\Local\Programs\Python\Python36\lib\site-packages\requests\adapters.py", line 506, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='slack.com', port=443): Max retries exceeded with url: /api/rtm.connect (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),))

What type of issue is this? (place an x in one of the [ ])

  • [x ] bug
  • enhancement (feature request)
  • question
  • documentation related
  • testing related
  • discussion

Requirements (place an x in each of the [ ])

  • [x ] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • [x ] I've read and agree to the Code of Conduct.
  • [x ] I've searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

slackclient version:

python version:3.6.5

OS version(s):Windows 10

Steps to reproduce:

Expected result:

What you expected to happen

Actual result:

What actually happened

Attachments:

Logs, screenshots, screencast, sample project, funny gif, etc.
errorpic1
errorpic2

Activity

  1. DanielLuu commented on Jun 7, 2018

    @DanielLuu

    What was your solution? @LMPK

  2. LMPK commented on Jun 7, 2018

    @LMPK
    Author

    @DanielLuu

    I had to go into the slackrequest.py file and under the 'return requests.post()' add in 'verify=False'. So it looks like this:

    return requests.post(
                url,
                headers=headers,
                data=post_data,
                verify=False,
                files=files,
                timeout=timeout,
                proxies=proxiess
                #proxies=self.proxies
            )
    

    This is a workaround that I found, so it is a bit janky, but it fixed that error for me.

    I also had to specify the proxies that are used at my company, and make sure these are referenced in the code above. By doing this:

    proxiess={
                'http': 'http://user:pass@proxy:port',
                'https': 'http://user:pass@proxy:port',
            }
    

    The above two fixed that problem, but I encountered an Slack Login Error after that which I am still trying to figure out.

    Hope this helps.

  3. pnfnp commented on Feb 26, 2020

    @pnfnp

    You can add ssl=True and works like a charm!

    client = slack.WebClient(token='my-secret-token', ssl=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions