Example #1
0
def capakey_factory(**kwargs):
    '''
    Factory that generates a CAPAKEY client.

    A few parameters will be handled by the factory, other parameters will
    be passed on to the client.

    :param user: `Required.` Username for authenticating with the CAPAKEY
        service.
    :param password: `Required.` Password for authenticating with the CAPAKEY
        service.
    :param wsdl: `Optional.` Allows overriding the default CAPAKEY wsdl url.
    :param proxy: `Optional.` A dictionary of proxy information that is passed
        to the underlying :class:`suds.client.Client`
    :rtype: :class:`suds.client.Client`
    '''
    if 'wsdl' in kwargs:
        wsdl = kwargs['wsdl']
        del kwargs['wsdl']
    else:
        wsdl = "http://ws.agiv.be/capakeyws/nodataset.asmx?WSDL"
    if 'user' in kwargs and 'password' in kwargs:
        user = kwargs['user']
        password = kwargs['password']
        del kwargs['user']
        del kwargs['password']
    else:
        raise ValueError("You must specify a 'user' and a 'password'.")
    log.info('Creating CAPAKEY client with wsdl: %s', wsdl)
    c = Client(wsdl, **kwargs)
    c.capakey_user = user
    c.capakey_password = password
    return c
Example #2
0
def capakey_factory(**kwargs):
    '''
    Factory that generates a CAPAKEY client.

    :rtype: :class:`suds.client.Client`
    '''
    if 'wsdl' in kwargs:
        wsdl = kwargs['wsdl']
        del kwargs['wsdl']
    else:
        wsdl = "http://ws.agiv.be/capakeyws/nodataset.asmx?WSDL"
    if 'user' in kwargs and 'password' in kwargs:
        user = kwargs['user']
        password = kwargs['password']
        del kwargs['user']
        del kwargs['password']
    else:
        raise ValueError(
            "You must specify a 'user' and a 'password'."
        )
    c = Client(
        wsdl,
        **kwargs
    )
    c.capakey_user = user
    c.capakey_password = password
    return c