from slacker import Slacker as BaseSlacker


__version__ = '0.0.1'


class Slacker(object):
    def __init__(self, app=None, **kwargs):
        """Initialize the Slacker interface.

        :param app: Flask application
        """
        if app is not None:
            self.init_app(app)

    def init_app(self, app, config=None):
        """
        Initialize the app in Flask.
        """
        if not (config is None or isinstance(config, dict)):
            raise ValueError("`config` must be an instance of dict or None")

        # register application within app
        app.extensions = getattr(app, 'extensions', {})
        app.extensions['slack'] = BaseSlacker(**config)

from slacker import Slacker as BaseSlacker, DEFAULT_TIMEOUT


__version__ = '0.0.1'


class Slacker(object):
    def __init__(self, app=None):
        """Initialize the Slacker interface.

        :param app: Flask application
        """
        if app is not None:
            self.init_app(app)

    def init_app(self, app):
        """
        Initialize the app in Flask.
        """
        app.config.setdefault('SLACKER_TIMEOUT', DEFAULT_TIMEOUT)

        if 'SLACKER_TOKEN' not in app.config:
            raise Exception('Missing SLACKER_TOKEN in your config.')

        token = app.config['SLACKER_TOKEN']
        timeout = app.config['SLACKER_TIMEOUT']

        # register application within app
        app.extensions = getattr(app, 'extensions', {})
        app.extensions['slack'] = BaseSlacker(token, timeout=timeout)

Load app configs for Slacker
Load app configs for Slacker

- from slacker import Slacker as BaseSlacker
+ from slacker import Slacker as BaseSlacker, DEFAULT_TIMEOUT
  
  
  __version__ = '0.0.1'
  
  
  class Slacker(object):
-     def __init__(self, app=None, **kwargs):
+     def __init__(self, app=None):
          """Initialize the Slacker interface.
  
          :param app: Flask application
          """
          if app is not None:
              self.init_app(app)
  
-     def init_app(self, app, config=None):
+     def init_app(self, app):
          """
          Initialize the app in Flask.
          """
-         if not (config is None or isinstance(config, dict)):
-             raise ValueError("`config` must be an instance of dict or None")
+         app.config.setdefault('SLACKER_TIMEOUT', DEFAULT_TIMEOUT)
+ 
+         if 'SLACKER_TOKEN' not in app.config:
+             raise Exception('Missing SLACKER_TOKEN in your config.')
+ 
+         token = app.config['SLACKER_TOKEN']
+         timeout = app.config['SLACKER_TIMEOUT']
  
          # register application within app
          app.extensions = getattr(app, 'extensions', {})
-         app.extensions['slack'] = BaseSlacker(**config)
+         app.extensions['slack'] = BaseSlacker(token, timeout=timeout)
  
Load app configs for Slacker
## Code Before:
from slacker import Slacker as BaseSlacker


__version__ = '0.0.1'


class Slacker(object):
    def __init__(self, app=None, **kwargs):
        """Initialize the Slacker interface.

        :param app: Flask application
        """
        if app is not None:
            self.init_app(app)

    def init_app(self, app, config=None):
        """
        Initialize the app in Flask.
        """
        if not (config is None or isinstance(config, dict)):
            raise ValueError("`config` must be an instance of dict or None")

        # register application within app
        app.extensions = getattr(app, 'extensions', {})
        app.extensions['slack'] = BaseSlacker(**config)

## Instruction:
Load app configs for Slacker
## Code After:
from slacker import Slacker as BaseSlacker, DEFAULT_TIMEOUT


__version__ = '0.0.1'


class Slacker(object):
    def __init__(self, app=None):
        """Initialize the Slacker interface.

        :param app: Flask application
        """
        if app is not None:
            self.init_app(app)

    def init_app(self, app):
        """
        Initialize the app in Flask.
        """
        app.config.setdefault('SLACKER_TIMEOUT', DEFAULT_TIMEOUT)

        if 'SLACKER_TOKEN' not in app.config:
            raise Exception('Missing SLACKER_TOKEN in your config.')

        token = app.config['SLACKER_TOKEN']
        timeout = app.config['SLACKER_TIMEOUT']

        # register application within app
        app.extensions = getattr(app, 'extensions', {})
        app.extensions['slack'] = BaseSlacker(token, timeout=timeout)
