Typedefs¶
Type definitions.
-
postcodepy.typedefs.
translate_addresstype
(f)¶ decorator to translate the addressType field.
translate the value of the addressType field of the API response into a translated type.
-
postcodepy.typedefs.
translate_purposes
(f)¶ decorator to translate the purposes field.
translate the values of the purposes field of the API response into translated values.
POSTCODE_API_TYPEDEFS_ADDRES_TYPES =
{
"building": "verblijfsobject",
"house boat site": "location used for mooring house boats",
"PO box": "PO box",
"mobile home site": "location used for mobile homes and trailers"
}
POSTCODE_API_TYPEDEFS_PURPOSES =
{
"assembly": "bijeenkomstfunctie",
"office": "kantoorfunctie",
"detention": "celfunctie",
"lodging": "logiesfunctie",
"shopping": "winkelfunctie",
"sport": "sportfunctie",
"education": "onderwijsfunctie",
"industry": "industriefunctie",
"other": "overige gebruiksfunctie",
"residency": "woonfunctie",
"healthcare": "gezondheidszorgfunctie"
}
The REST responses may contain fields that can be translated into the standard descriptions as provided by postcode.nl. This translation can be accomplished by simply applying the decorators to a function that parses the return value of the API-call.
Logging¶
In case values can’t be translated, a warning is logged by logger. The message will contain the postcode that was responsible for the warning.