API Documentation

Client module

This module contains utility functions for interacting with AGIV SOAP services.

New in version 0.1.0.

crabpy.client.capakey_factory(**kwargs)[source]

Factory that generates a CAPAKEY client.

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

Parameters:
  • userRequired. Username for authenticating with the CAPAKEY service.
  • passwordRequired. Password for authenticating with the CAPAKEY service.
  • wsdlOptional. Allows overriding the default CAPAKEY wsdl url.
  • proxyOptional. A dictionary of proxy information that is passed to the underlying suds.client.Client
Return type:

suds.client.Client

crabpy.client.capakey_request(client, action, *args)[source]

Utility function that helps making requests to the CAPAKEY service.

Parameters:
  • client – A suds.client.Client for the CAPAKEY service.
  • action (string) – Which method to call, eg. ListAdmGemeenten.
Returns:

Result of the SOAP call.

crabpy.client.crab_factory(**kwargs)[source]

Factory that generates a CRAB client.

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

Parameters:
  • wsdlOptional. Allows overriding the default CRAB wsdl url.
  • proxyOptional. A dictionary of proxy information that is passed to the underlying suds.client.Client
Return type:

suds.client.Client

crabpy.client.crab_request(client, action, *args)[source]

Utility function that helps making requests to the CRAB service.

Parameters:
  • client – A suds.client.Client for the CRAB service.
  • action (string) – Which method to call, eg. ListGewesten
Returns:

Result of the SOAP call.

New in version 0.3.0.

Crab gateway module

This module contains an opionated gateway for the crab webservice.

New in version 0.3.0.

class crabpy.gateway.crab.Aardadres(id, naam, definitie, **kwargs)[source]

The nature of an address.

class crabpy.gateway.crab.Aardgebouw(id, naam, definitie, **kwargs)[source]

The nature of a building.

class crabpy.gateway.crab.Aardsubadres(id, naam, definitie, **kwargs)[source]

The nature of a subaddress.

class crabpy.gateway.crab.Aardterreinobject(id, naam, definitie, **kwargs)[source]

The nature of a terreinobject.

class crabpy.gateway.crab.Aardwegobject(id, naam, definitie, **kwargs)[source]

The nature of a wegobject.

class crabpy.gateway.crab.Bewerking(id, naam, definitie, **kwargs)[source]

An edit.

class crabpy.gateway.crab.CrabGateway(client, **kwargs)[source]

A gateway to the CRAB webservice.

get_gebouw_by_id(id)[source]

Retrieve a Gebouw by the Id.

Parameters:id (integer) – the Id of the Gebouw
Return type:Gebouw
get_gemeente_by_id(id)[source]

Retrieve a gemeente by the crab id.

Parameters:id (integer) – The CRAB id of the gemeente.
Return type:Gemeente
get_gemeente_by_niscode(niscode)[source]

Retrieve a gemeente by the NIScode.

Parameters:niscode (integer) – The NIScode of the gemeente.
Return type:Gemeente
get_gewest_by_id(id)[source]

Get a gewest by id.

Parameters:id (integer) – The id of a gewest.
Return type:A Gewest.
get_huisnummer_by_id(id)[source]

Retrieve a huisnummer by the Id.

Parameters:id (integer) – the Id of the huisnummer
Return type:Huisnummer
get_huisnummer_by_nummer_and_straat(nummer, straat)[source]

Retrieve a huisnummer by the nummer and straat

Parameters:
  • nummer (integer) – The huisnummer of the ‘huisnummer`
  • straat – The Straat in which the huisnummer is situated.
Return type:

A Huisnummer

get_perceel_by_id(id)[source]

Retrieve a Perceel by the Id.

Parameters:id (string) – the Id of the Perceel
Return type:Perceel
get_postkanton_by_huisnummer(huisnummer)[source]

Retrieve a postkanton by the Huisnummer.

Parameters:huisnummer – The Huisnummer for which the postkanton is wanted.
Return type:Postkanton
get_provincie_by_id(niscode)[source]

Retrieve a provincie by the niscode.

Parameters:niscode (integer) – The niscode of the provincie.
Return type:Provincie
get_straat_by_id(id)[source]

Retrieve a straat by the Id.

Parameters:id (integer) – The id of the straat.
Return type:Straat
get_terreinobject_by_id(id)[source]

Retrieve a Terreinobject by the Id.

Parameters:id (integer) – the Id of the Terreinobject
Return type:Terreinobject
get_wegobject_by_id(id)[source]

Retrieve a Wegobject by the Id.

Parameters:id (integer) – the Id of the Wegobject
Return type:Wegobject
get_wegsegment_by_id(id)[source]

Retrieve a wegsegment by the Id.

Parameters:id (integer) – the Id of the wegsegment
Return type:Wegsegment
list_aardadressen(sort=1)[source]

List all aardadressen.

Return type:A list of Aardadres
list_aardgebouwen(sort=1)[source]

List all aardgebouwen.

Return type:A list of Aardgebouw
list_aardsubadressen(sort=1)[source]

List all aardsubadressen.

Return type:A list of Aardsubadres
list_aardterreinobjecten(sort=1)[source]

List all aardterreinobjecten.

Return type:A list of Aardterreinobject
list_aardwegobjecten(sort=1)[source]

List all aardwegobjecten.

Return type:A list of Aardwegobject
list_bewerkingen(sort=1)[source]

List all bewerkingen.

Return type:A list of Bewerking
list_gebouwen_by_huisnummer(huisnummer)[source]

List all gebouwen for a Huisnummer.

Parameters:huisnummer – The Huisnummer for which the gebouwen are wanted.
Return type:A list of Gebouw
list_gemeenten(gewest=2, sort=1)[source]

List all gemeenten in a gewest.

Parameters:
  • gewest – The Gewest for which the gemeenten are wanted.
  • sort (integer) – What field to sort on.
Return type:

A list of Gemeente.

list_gemeenten_by_provincie(provincie, sort=2)[source]

List all gemeenten in a provincie.

Parameters:
  • provincie – The Provincie for which the gemeenten are wanted.
  • sort (integer) – What field to sort on.
Return type:

A list of Gemeente.

list_geometriemethodegebouwen(sort=1)[source]

List all geometriegebouwen.

Return type:A list of Geometriegebouw
list_geometriemethodewegsegmenten(sort=1)[source]

List all geometriemethodewegsegmenten.

Return type:A list of Geometriemethodewegsegment
list_gewesten(sort=1)[source]

List all gewesten in Belgium.

Parameters:sort (integer) – What field to sort on.
Return type:A :class`list` of class: Gewest.
list_herkomstadresposities(sort=1)[source]

List all herkomstadresposities.

Return type:A list of Herkomstadrespositie
list_huisnummers_by_straat(straat, sort=1)[source]

List all huisnummers in a Straat.

Parameters:straat – The Straat for which the huisnummers are wanted.
Return type:A :class: list of Huisnummer
list_organisaties(sort=1)[source]

List all organisaties.

Return type:A list of Organisatie
list_percelen_by_huisnummer(huisnummer)[source]

List all percelen for a Huisnummer

Parameters:huisnummer – The Huisnummer for which the percelen are wanted.
Return type:A list of Perceel
list_postkantons_by_gemeente(gemeente)[source]

List all postkantons in a Gemeente

Parameters:gemeente – The Gemeente for which the potkantons are wanted.
Return type:A list of Postkanton
list_provincies(gewest=2)[source]

List all provincies in a gewest.

Parameters:
  • gewest – The Gewest for which the provincies are wanted.
  • sort (integer) – What field to sort on.
Return type:

A list of Provincie.

list_statusgebouwen(sort=1)[source]

List all statusgebouwen.

Return type:A list of Statusgebouwen
list_statushuisnummers(sort=1)[source]

List all statushuisnummers.

Return type:A list of Statushuisnummer
list_statusstraatnamen(sort=1)[source]

List all statusstraatnamen.

Return type:A list of Statusstraatnaam
list_statussubadressen(sort=1)[source]

List all statussubadressen.

Return type:A list of Statussubadres
list_statuswegsegmenten(sort=1)[source]

List all statuswegsegmenten.

Return type:A list of Statuswegsegment
list_straten(gemeente, sort=1)[source]

List all straten in a Gemeente.

Parameters:gemeente – The Gemeente for which the straten are wanted.
Return type:A list of Straat
list_talen(sort=1)[source]

List all talen.

Return type:A list of Taal
list_terreinobjecten_by_huisnummer(huisnummer)[source]

List all terreinobjecten for a Huisnummer

Parameters:huisnummer – The Huisnummer for which the terreinobjecten are wanted.
Return type:A list of Terreinobject
list_wegobjecten_by_straat(straat)[source]

List all wegobjecten in a Straat

Parameters:straat – The Straat for which the wegobjecten are wanted.
Return type:A list of Wegobject
list_wegsegmenten_by_straat(straat)[source]

List all wegsegmenten in a Straat

Parameters:straat – The Straat for which the wegsegmenten are wanted.
Return type:A list of Wegsegment
class crabpy.gateway.crab.GatewayObject(**kwargs)[source]

Abstract class for objects that are able to use a crabpy.Gateway.CrabGateway to find further information.

check_gateway()[source]

Check to see if a gateway was set on this object.

clear_gateway()[source]

Clear the currently set CrabGateway.

gateway = None

The crabpy.gateway.crab.CrabGateway to use when making further calls to the CRAB service.

set_gateway(gateway)[source]
Parameters:gateway (crabpy.gateway.crab.CrabGateway) – Gateway to use.
class crabpy.gateway.crab.Gebouw(id, aard, status, methode=None, geometrie=None, metadata=None, **kwargs)[source]

A building.

class crabpy.gateway.crab.Gemeente(id, naam, niscode, gewest, taal=None, centroid=None, bounding_box=None, metadata=None, **kwargs)[source]

The smallest administrative unit in Belgium.

clear_gateway()[source]

Clear the currently set CrabGateway.

set_gateway(gateway)[source]
Parameters:gateway (crabpy.gateway.crab.CrabGateway) – Gateway to use.
class crabpy.gateway.crab.Geometriemethodegebouw(id, naam, definitie, **kwargs)[source]

The geometry method of a Gebouw.

class crabpy.gateway.crab.Geometriemethodewegsegment(id, naam, definitie, **kwargs)[source]

The geometry method of a Wegsegment.

class crabpy.gateway.crab.Gewest(id, namen=None, centroid=None, bounding_box=None, **kwargs)[source]

A large administrative unit in Belgium.

Belgium consists of 3 gewesten. Together they form the entire territory of the country.

class crabpy.gateway.crab.Herkomstadrespositie(id, naam, definitie, **kwargs)[source]

The origin of an Adressposition.

class crabpy.gateway.crab.Huisnummer(id, status, huisnummer, straat_id, metadata=None, **kwargs)[source]

A house number.

This is mainly a combination of a street and a house number.

class crabpy.gateway.crab.Metadata(begin_datum, begin_tijd, begin_bewerking, begin_organisatie, **kwargs)[source]

Metadata about a straat, huisnummer, ...

Some of the metadata available is the datum the object was created, the organisation that created it and the type of creation.

class crabpy.gateway.crab.Organisatie(id, naam, definitie, **kwargs)[source]

An organisation that played a role in the genessis of an object.

class crabpy.gateway.crab.Perceel(id, centroid=None, metadata=None, **kwargs)[source]

A cadastral Parcel.

A Terreinobject is somewhat different from a Perceel in the source of the data and the information provided. eg. A terreinobject has a centroid and a bounding box, while a perceel also has the centroid, but not the bounding box.

class crabpy.gateway.crab.Postkanton(id, **kwargs)[source]

A postal code.

Eg. postal code 9000 for the city of Ghent.

class crabpy.gateway.crab.Provincie(niscode, naam, gewest, **kwargs)[source]

The largest administrative unit within a Gewest.

New in version 0.4.0.

clear_gateway()[source]

Clear the currently set CrabGateway.

set_gateway(gateway)[source]
Parameters:gateway (crabpy.gateway.crab.CrabGateway) – Gateway to use.
class crabpy.gateway.crab.Statusgebouw(id, naam, definitie, **kwargs)[source]

The current state of a Gebouw.

class crabpy.gateway.crab.Statushuisnummer(id, naam, definitie, **kwargs)[source]

The current state of a huisnummer.

class crabpy.gateway.crab.Statusstraatnaam(id, naam, definitie, **kwargs)[source]

The current state of a straatnaam.

class crabpy.gateway.crab.Statussubadres(id, naam, definitie, **kwargs)[source]

The current state of a subadres.

class crabpy.gateway.crab.Statuswegsegment(id, naam, definitie, **kwargs)[source]

The current state of a wegsegment.

class crabpy.gateway.crab.Straat(id, label, gemeente_id, status, straatnaam=None, taalcode=None, straatnaam2=None, taalcode2=None, metadata=None, **kwargs)[source]

A street.

A street object is always located in one and exactly one Gemeente.

class crabpy.gateway.crab.Taal(id, naam, definitie, **kwargs)[source]

A language.

class crabpy.gateway.crab.Terreinobject(id, aard, centroid=None, bounding_box=None, metadata=None, **kwargs)[source]

A cadastral parcel.

A Terreinobject is somewhat different from a Perceel in the source of the data and the information provided. eg. A terreinobject has a centroid and a bounding box, while a perceel also has the centroid, but not the bounding box.

crabpy.gateway.crab.check_lazy_load_gebouw(f)[source]

Decorator function to lazy load a Gebouw.

crabpy.gateway.crab.check_lazy_load_gemeente(f)[source]

Decorator function to lazy load a Gemeente.

crabpy.gateway.crab.check_lazy_load_gewest(f)[source]

Decorator function to lazy load a Gewest.

crabpy.gateway.crab.check_lazy_load_huisnummer(f)[source]

Decorator function to lazy load a Huisnummer.

crabpy.gateway.crab.check_lazy_load_perceel(f)[source]

Decorator function to lazy load a Perceel.

crabpy.gateway.crab.check_lazy_load_straat(f)[source]

Decorator function to lazy load a Straat.

crabpy.gateway.crab.check_lazy_load_terreinobject(f)[source]

Decorator function to lazy load a Terreinobject.

crabpy.gateway.crab.check_lazy_load_wegobject(f)[source]

Decorator function to lazy load a Wegobject.

crabpy.gateway.crab.check_lazy_load_wegsegment(f)[source]

Decorator function to lazy load a Wegsegment.

crabpy.gateway.crab.crab_gateway_request(client, method, *args)[source]

Utility function that helps making requests to the CRAB service.

This is a specialised version of crabpy.client.crab_request() that allows adding extra functionality for the calls made by the gateway.

Parameters:
  • client – A suds.client.Client for the CRAB service.
  • action (string) – Which method to call, eg. ListGewesten
Returns:

Result of the SOAP call.

Capakey gateway module

This module contains an opionated gateway for the capakey webservice.

New in version 0.2.0.

class crabpy.gateway.capakey.Afdeling(id, naam=None, gemeente=None, centroid=None, bounding_box=None, **kwargs)[source]

A Cadastral Division of a Gemeente.

clear_gateway()[source]

Clear the currently set CapakeyGateway.

set_gateway(gateway)[source]
Parameters:gateway (crabpy.gateway.capakey.CapakeyGateway) – Gateway to use.
class crabpy.gateway.capakey.CapakeyGateway(client, **kwargs)[source]

A gateway to the capakey webservice.

get_gemeente_by_id(id)[source]

Retrieve a gemeente by id (the NIScode).

Return type:Gemeente
get_kadastrale_afdeling_by_id(id)[source]

Retrieve a ‘kadastrale afdeling’ by id.

Parameters:id – An id of a kadastrale afdeling.
Return type:A Afdeling.
get_perceel_by_capakey(capakey)[source]

Get a perceel.

Parameters:capakey – An capakey for a perceel.
Return type:Perceel
get_perceel_by_id_and_sectie(id, sectie)[source]

Get a perceel.

Parameters:
  • id – An id for a perceel.
  • sectie – The Sectie that contains the perceel.
Return type:

Perceel

get_perceel_by_percid(percid)[source]

Get a perceel.

Parameters:percid – A percid for a perceel.
Return type:Perceel
get_sectie_by_id_and_afdeling(id, afdeling)[source]

Get a sectie.

Parameters:
  • id – An id of a sectie. eg. “A”
  • afdeling – The Afdeling for in which the sectie can be found. Can also be the id of and afdeling.
Return type:

A Sectie.

list_gemeenten(sort=1)[source]

List all gemeenten in Vlaanderen.

Parameters:sort (integer) – What field to sort on.
Return type:A list of Gemeente.
list_kadastrale_afdelingen(sort=1)[source]

List all kadastrale afdelingen in Flanders.

Parameters:sort (integer) – Field to sort on.
Return type:A list of Afdeling.
list_kadastrale_afdelingen_by_gemeente(gemeente, sort=1)[source]

List all kadastrale afdelingen in a gemeente.

Parameters:
  • gemeente – The Gemeente for which the afdelingen are wanted.
  • sort (integer) – Field to sort on.
Return type:

A list of Afdeling.

list_percelen_by_sectie(sectie, sort=1)[source]

List all percelen in a sectie.

Parameters:
  • sectie – The Sectie for which the percelen are wanted.
  • sort (integer) – Field to sort on.
Return type:

A list of Perceel.

list_secties_by_afdeling(afdeling)[source]

List all secties in a kadastrale afdeling.

Parameters:afdeling – The Afdeling for which the secties are wanted. Can also be the id of and afdeling.
Return type:A list of Sectie.
class crabpy.gateway.capakey.GatewayObject(**kwargs)[source]

Abstract class for all objects being returned from the Gateway.

check_gateway()[source]

Check to see if a gateway was set on this object.

clear_gateway()[source]

Clear the currently set CapakeyGateway.

gateway = None

The crabpy.gateway.capakey.CapakeyGateway to use when making further calls to the Capakey service.

set_gateway(gateway)[source]
Parameters:gateway (crabpy.gateway.capakey.CapakeyGateway) – Gateway to use.
class crabpy.gateway.capakey.Gemeente(id, naam=None, centroid=None, bounding_box=None, **kwargs)[source]

The smallest administrative unit in Belgium.

class crabpy.gateway.capakey.Perceel(id, sectie, capakey, percid, capatype=None, cashkey=None, centroid=None, bounding_box=None, **kwargs)[source]

A Cadastral Parcel.

clear_gateway()[source]

Clear the currently set CapakeyGateway.

set_gateway(gateway)[source]
Parameters:gateway (crabpy.gateway.capakey.CapakeyGateway) – Gateway to use.
class crabpy.gateway.capakey.Sectie(id, afdeling, centroid=None, bounding_box=None, **kwargs)[source]

A subdivision of a Afdeling.

clear_gateway()[source]

Clear the currently set CapakeyGateway.

set_gateway(gateway)[source]
Parameters:gateway (crabpy.gateway.capakey.CapakeyGateway) – Gateway to use.
crabpy.gateway.capakey.capakey_gateway_request(client, method, *args)[source]

Utility function that helps making requests to the CAPAKEY service.

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

Parameters:
  • client – A suds.client.Client for the CAPAKEY service.
  • action (string) – Which method to call, eg. ListAdmGemeenten.
Returns:

Result of the SOAP call.

crabpy.gateway.capakey.check_lazy_load_afdeling(f)[source]

Decorator function to lazy load a Afdeling.

crabpy.gateway.capakey.check_lazy_load_gemeente(f)[source]

Decorator function to lazy load a Gemeente.

crabpy.gateway.capakey.check_lazy_load_perceel(f)[source]

Decorator function to lazy load a Perceel.

crabpy.gateway.capakey.check_lazy_load_sectie(f)[source]

Decorator function to lazy load a Sectie.

Gateway exception module

This module contains custom errors that can be generated by gateways.

New in version 0.2.0.

exception crabpy.gateway.exception.GatewayAuthenticationException(message, soapfault)[source]

An exception that signifies something went wrong during authentication.

exception crabpy.gateway.exception.GatewayException(message)[source]

A base exception.

exception crabpy.gateway.exception.GatewayRuntimeException(message, soapfault)[source]

An exception that signifies a soap request went wrong.

soapfault = None

The soapfault that was generated by the service.

Wsa module

This module contains utiltiy functions for using WSA with SOAP services.

New in version 0.1.0.

class crabpy.wsa.Action(action)[source]

Assist in rendering a WSA:Action element.

class crabpy.wsa.MessageID[source]

Assist in rendering a WSA:MessageID element.

class crabpy.wsa.To(location)[source]

Assist in rendering a WSA:To element.

Wsse module

This module adds a UsernameDigestToken for use with SOAP services.

New in version 0.2.0.

class crabpy.wsse.UsernameDigestToken(username=None, password=None)[source]

Represents a basic WS-Security token with password digest