slackapi/python-slack-events-api

Enable proxy support for slackeventsapi

pbmohankumar opened this issue · 2 comments

Description

Describe your issue here.

Hi Team ,

In my current setup the flask server is behind a proxy. In this scenario from slackeventsapi does not have a option to define proxy server details.

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

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

Requirements

  • [ X] I've read and understood the Contributing guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • 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.

from slackeventsapi import SlackEventAdapter
slack_events_adapter = SlackEventAdapter(SLACK_SIGNING_SECRET, "/slack/events", app)
[Mon Jan 13 13:11:00.817386 2020] [:error] [pid 11922] [client 132.240.205.180:29626]   File "/usr/lib/python2.7/site-packages/slackclient/slackrequest.py", line 116, in post_http_request
[Mon Jan 13 13:11:00.817407 2020] [:error] [pid 11922] [client 132.240.205.180:29626]     proxies=self.proxies
[Mon Jan 13 13:11:00.817412 2020] [:error] [pid 11922] [client 132.240.205.180:29626]   File "/usr/lib/python2.7/site-packages/requests/api.py", line 116, in post
[Mon Jan 13 13:11:00.817416 2020] [:error] [pid 11922] [client 132.240.205.180:29626]     return request('post', url, data=data, json=json, **kwargs)
[Mon Jan 13 13:11:00.817421 2020] [:error] [pid 11922] [client 132.240.205.180:29626]   File "/usr/lib/python2.7/site-packages/requests/api.py", line 60, in request
[Mon Jan 13 13:11:00.817425 2020] [:error] [pid 11922] [client 132.240.205.180:29626]     return session.request(method=method, url=url, **kwargs)
[Mon Jan 13 13:11:00.817429 2020] [:error] [pid 11922] [client 132.240.205.180:29626]   File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 533, in request
[Mon Jan 13 13:11:00.817433 2020] [:error] [pid 11922] [client 132.240.205.180:29626]     resp = self.send(prep, **send_kwargs)
[Mon Jan 13 13:11:00.817438 2020] [:error] [pid 11922] [client 132.240.205.180:29626]   File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 646, in send
[Mon Jan 13 13:11:00.817442 2020] [:error] [pid 11922] [client 132.240.205.180:29626]     r = adapter.send(request, **kwargs)
[Mon Jan 13 13:11:00.817448 2020] [:error] [pid 11922] [client 132.240.205.180:29626]   File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 516, in send
[Mon Jan 13 13:11:00.817453 2020] [:error] [pid 11922] [client 132.240.205.180:29626]     raise ConnectionError(e, request=request)
[Mon Jan 13 13:11:00.817461 2020] [:error] [pid 11922] [client 132.240.205.180:29626] ConnectionError: HTTPSConnectionPool(host='slack.com', port=443): Max retries exceeded with url: /api/chat.postMessage (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f6de251e910>: Failed to establish a new connection: [Errno 110] Connection timed out',))

Reproducible in:

slackeventsapi version:
python version:
OS version(s):

Steps to reproduce:

Expected result:

What you expected to happen

Actual result:

What actually happened

Attachments:

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

@pbmohankumar
I've created a simple app illustrating how to use slackeventsapi and slackclient behind a proxy server. https://github.com/slackapi/python-slack-events-api/blob/master/example/working_with_proxy/example.py

This example uses slackclient 2.x with Python 3. It seems you're using slackclient 1.x with Python 2.7 but we're no longer actively maintaining the version. Please consider upgrading the major versions of slackclient and Python.

Regarding incoming requests from Slack, I don't think you have any blockers for receiving those. But if I'm missing something, please let me know more details.

If the above information is helpful for you, could you close this issue?

As it seems the maintainers of this project have no further actions to take here, please allow me to close this issue now. Feel free to write in or reopen when you see the necessity to do so.