smsframework/Gateway.py
def add_provider(self, name, Provider, **config):
        """ Register a provider on the gateway

            The first provider defined becomes the default one: used in case the routing function has no better idea.

            :type name: str
            :param name: Provider name that will be used to uniquely identify it
            :type Provider: type
            :param Provider: Provider class that inherits from `smsframework.IProvider`
            :param config: Provider configuration. Please refer to the Provider documentation.
            :rtype: IProvider
            :returns: The created provider
        """
        assert issubclass(Provider, IProvider), 'Provider does not implement IProvider'
        assert isinstance(name, str), 'Provider name must be a string'

        # Configure
        provider = Provider(self, name, **config)

        # Register
        assert name not in self._providers, 'Provider is already registered'
        self._providers[name] = provider

        # If first - set default
        if self.default_provider is None:
            self.default_provider = name

        # Finish
        return provider
def add_provider(self, name, Provider, **config):
        assert issubclass(Provider, IProvider), 'Provider does not implement IProvider'
        assert isinstance(name, str), 'Provider name must be a string'

        # Configure
        provider = Provider(self, name, **config)

        # Register
        assert name not in self._providers, 'Provider is already registered'
        self._providers[name] = provider

        # If first - set default
        if self.default_provider is None:
            self.default_provider = name

        # Finish
        return provider
def add_provider ( self , name , Provider , * * config ) : assert issubclass ( Provider , IProvider ) , 'Provider does not implement IProvider' assert isinstance ( name , str ) , 'Provider name must be a string' # Configure provider = Provider ( self , name , * * config ) # Register assert name not in self . _providers , 'Provider is already registered' self . _providers [ name ] = provider # If first - set default if self . default_provider is None : self . default_provider = name # Finish return provider
Register a provider on the gateway

            The first provider defined becomes the default one: used in case the routing function has no better idea.

            :type name: str
            :param name: Provider name that will be used to uniquely identify it
            :type Provider: type
            :param Provider: Provider class that inherits from `smsframework.IProvider`
            :param config: Provider configuration. Please refer to the Provider documentation.
            :rtype: IProvider
            :returns: The created provider
Register a provider on the gateway