Ejemplo n.º 1
0
def capakey_gateway_request(client, method, *args):
    try:
        return capakey_request(client, method, *args)
    except WebFault as wf:
        if wf.fault['faultcode'] == 'q0:FailedAuthentication':
            err = GatewayAuthenticationException(
                'Could not authenticate with capakey service. Message from server:\n%s' % wf.fault['faultstring'],
                wf
            )
        else:
            err = GatewayRuntimeException(
                'Could not execute request. Message from server:\n%s' % wf.fault['faultstring'],
                wf
            )
        raise err
Ejemplo n.º 2
0
def capakey_gateway_request(client, method, *args):
    '''
    Utility function that helps making requests to the CAPAKEY service.

    This is a specialised version of :func:`crabpy.client.capakey_request` that
    allows adding extra functionality like general error handling for the
    calls made by the gateway.

    :param client: A :class:`suds.client.Client` for the CAPAKEY service.
    :param string action: Which method to call, eg. `ListAdmGemeenten`.
    :returns: Result of the SOAP call.
    '''
    try:
        return capakey_request(client, method, *args)
    except WebFault as wf:
        if wf.fault['faultcode'] == 'q0:FailedAuthentication':
            err = GatewayAuthenticationException(
                'Could not authenticate with capakey service. Message from server:\n%s'
                % wf.fault['faultstring'], wf)
        else:
            err = GatewayRuntimeException(
                'Could not execute request. Message from server:\n%s' %
                wf.fault['faultstring'], wf)
        raise err
Ejemplo n.º 3
0
 def test_list_gemeenten(self, capakey):
     res = capakey_request(capakey, 'ListAdmGemeenten', 1)
     assert len(res) > 0
Ejemplo n.º 4
0
 def test_list_gemeenten(self):
     res = capakey_request(self.capakey, 'ListAdmGemeenten', 1)
Ejemplo n.º 5
0
# -*- coding: utf-8 -*-
'''
This script demonstrates using the capakey client through the
:func:`crabpy.client.capakey_request` function.
'''

from crabpy.client import capakey_factory, capakey_request

capakey = capakey_factory(user='******', password='******')

res = capakey_request(capakey, 'ListAdmGemeenten', 1)
print(res)

res = capakey_request(capakey, 'ListKadAfdelingenByNiscode', 44021, 1)
print(res)

res = capakey_request(capakey, 'ListKadSectiesByKadAfdelingcode', 44021)
print(res)

res = capakey_request(capakey, 'ListKadPerceelsnummersByKadSectiecode', 44021,
                      'A', 1)
print(res)

res = capakey_request(capakey, 'GetKadPerceelsnummerByCaPaKey',
                      '44021A3675/00A000')
print(res)
Ejemplo n.º 6
0
from crabpy.client import capakey_factory, capakey_request

capakey = capakey_factory(
    user='******',
    password='******'
)

print capakey

res = capakey_request(capakey, 'ListAdmGemeenten', 1)

print res

res = capakey_request(capakey, 'ListKadAfdelingenByNiscode', 44021, 1)

print res

print capakey_request(capakey, 'ListKadSectiesByKadAfdelingcode', 44021)

print capakey_request(capakey, 'ListKadPerceelsnummersByKadSectiecode', 44021, 'A', 1)

print capakey_request(capakey, 'GetKadPerceelsnummerByCaPaKey', '44021A3675/00A000')