-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy path__init__.py
26 lines (22 loc) · 1.2 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from pyee import BaseEventEmitter
from .server import SlackServer
class SlackEventAdapter(BaseEventEmitter):
# Initialize the Slack event server
# If no endpoint is provided, default to listening on '/slack/events'
def __init__(self, signing_secret, endpoint="/slack/events", server=None, **kwargs):
BaseEventEmitter.__init__(self)
if signing_secret is None:
message = "signing_secret is required but you passed None in the first argument"
raise ValueError(message)
self.signing_secret = signing_secret
self.server = SlackServer(signing_secret, endpoint, self, server, **kwargs)
def start(self, host='127.0.0.1', port=None, debug=False, **kwargs):
"""
Start the built in webserver, bound to the host and port you'd like.
Default host is `127.0.0.1` and port 8080.
:param host: The host you want to bind the build in webserver to
:param port: The port number you want the webserver to run on
:param debug: Set to `True` to enable debug level logging
:param kwargs: Additional arguments you'd like to pass to Flask
"""
self.server.run(host=host, port=port, debug=debug, **kwargs)