CRABpy Documentation. Release 0.2.1. Flanders Heritage Agency



Similar documents
skosprovider_rdf Documentation

Fairsail REST API: Guide for Developers

GravityLab Multimedia Inc. Windows Media Authentication Administration Guide

webcrm API Getting Started

Databricks Cloud Platform Native REST API 1.0

Lecture 11 Web Application Security (part 1)

vcommander will use SSL and session-based authentication to secure REST web services.

OAuth 2.0 Developers Guide. Ping Identity, Inc th Street, Suite 100, Denver, CO

JupyterHub Documentation

White Paper BMC Remedy Action Request System Security

Django Two-Factor Authentication Documentation

DNS Update API November 15, 2006 Version 2.0.3

Wireless Security Camera with the Arduino Yun

API documentation - 1 -

Authentication and Single Sign On

Setting Up the Mercent Marketplace Price Optimizer Extension

Cloud Elements ecommerce Hub Provisioning Guide API Version 2.0 BETA

IIS SECURE ACCESS FILTER 1.3

Security IIS Service Lesson 6

CMDBuild Authentication (file auth.conf)

STABLE & SECURE BANK lab writeup. Page 1 of 21

Product Name: ANZ egate Connect Version: Document Type: Help doc Author: Milople Inc.

Release Notes. Platform Compatibility. Supported Operating Systems and Browsers: AMC. WorkPlace

Collax Web Security. Howto. This howto describes the setup of a Web proxy server as Web content filter.

Tableau Server Trusted Authentication

LICENSE4J LICENSE ACTIVATION AND VALIDATION PROXY SERVER USER GUIDE

HGC SUPERHUB HOSTED EXCHANGE

Databricks Cloud Platform Native REST API 1.1

MyanPay API Integration with Magento CMS

Open source framework for interactive data exploration in server based architecture

Certified The Grinder Testing Professional VS-1165

GetLibraryUserOrderList

e-filing Secure Web Service User Manual

Archelon Documentation

Plugin Integration Guide

UFTP AUTHENTICATION SERVICE

Creating federated authorisation

Bubble Code Review for Magento

Administering Jive Mobile Apps

Apigee Gateway Specifications

Secure Authentication and Session. State Management for Web Services

This course provides students with the knowledge and skills to develop ASP.NET MVC 4 web applications.

ACS 5.x and later: Integration with Microsoft Active Directory Configuration Example

Opacus Outlook Addin v3.x User Guide

UForge 3.4 Release Notes

Phone Manager Application Support JANUARY 2015 DOCUMENT RELEASE 4.2 APPLICATION SUPPORT

Contents About the Contract Management Post Installation Administrator's Guide... 5 Viewing and Modifying Contract Management Settings...

socketio Documentation

requests_toolbelt Documentation

JobScheduler Web Services Executing JobScheduler commands

Exploiting the Web with Tivoli Storage Manager

Installing the ASP.NET VETtrak APIs onto IIS 5 or 6

AD Account Lockout Investigation and Root Cause Analysis

Magento OpenERP Integration Documentation

Securing ArcGIS Server Services: First Steps

BlackBerry Enterprise Service 10. Universal Device Service Version: Administration Guide

Interwise Connect. Working with Reverse Proxy Version 7.x

Amazon Glacier. Developer Guide API Version

Contents. 2 Alfresco API Version 1.0

OPENIAM ACCESS MANAGER. Web Access Management made Easy

Crawl Proxy Installation and Configuration Guide

Web Service Facade for PHP5. Andreas Meyer, Sebastian Böttner, Stefan Marr

SnapLogic Salesforce Snap Reference

Enterprise Application Security Workshop Series

17 March 2013 NIEM Web Services API Version 1.0 URI:

Django Assess Managed Nicely Documentation

Copyright

ESET Secure Authentication Java SDK

Spectrum Technology Platform. Version 9.0. Administration Guide

AXIGEN Mail Server. Quick Installation and Configuration Guide. Product version: 6.1 Document version: 1.0

Copyright 2013 Consona Corporation. All rights reserved

Creating a DUO MFA Service in AWS

User Guide Part 7. Status Server

Elluminate Live! Access Guide. Page 1 of 7

Single Sign-On for the UQ Web

Setup Guide Access Manager 3.2 SP3

Integration Overview. Web Services and Single Sign On

CommonSpot Content Server Version 6.2 Release Notes

How to pull content from the PMP into Core Publisher

[MS-BDSRR]: Business Document Scanning: Scan Repository Capabilities and Status Retrieval Protocol

DEPLOYMENT GUIDE Version 1.2. Deploying the BIG-IP system v10 with Microsoft Exchange Outlook Web Access 2007

Revolution R Enterprise DeployR 7.1 Enterprise Security Guide. Authentication, Authorization, and Access Controls

Web Services for Management Perl Library VMware ESX Server 3.5, VMware ESX Server 3i version 3.5, and VMware VirtualCenter 2.5

PowerLink for Blackboard Vista and Campus Edition Install Guide

Kaldeera Workflow Designer 2010 User's Guide

AD Phonebook 2.2. Installation and configuration. Dovestones Software

depl Documentation Release depl contributors

WorldCat Local. May Install Notice

1. Open the Account Settings window by clicking on Account Settings from the Entourage menu.

SOAP Tips, Tricks & Tools

dinero Documentation Release Fusionbox

How To Build A Connector On A Website (For A Nonprogrammer)

SchoolBooking SSO Integration Guide

How To Test Your Web Site On Wapt On A Pc Or Mac Or Mac (Or Mac) On A Mac Or Ipad Or Ipa (Or Ipa) On Pc Or Ipam (Or Pc Or Pc) On An Ip

This chapter describes how to use the Junos Pulse Secure Access Service in a SAML single sign-on deployment. It includes the following sections:

Transcription:

CRABpy Documentation Release 0.2.1 Flanders Heritage Agency March 10, 2014

Contents i

ii

This library provides access to the CRAB and CAPAKEY webservices operated by the AGIV. Because connecting to these SOAP services from python can be somewhat complicated, this library makes it easier to use the service. We also plan to offer a somewhat more opionated wrapper around the services to straighten out some rough edges in the API and as an integration point for some caching. Contents 1

2 Contents

CHAPTER 1 Using CRABpy 1.1 Using the CRAB webservice Recently, the CRAB service has become public. The need to authenticate has been removed, making it a whole lot easier to connect. from crabpy.client import crab_factory crab = crab_factory() res = crab.service.listgemeentenbygewestid(1) print res 1.2 Using the CAPAKEY webservice This service does still require authentication. This requires a valid account from agiv. Because the authentication also requires some extra WS-Addressing headers, a utility function has been provided to make life easier. from crabpy.client import capakey_factory, capakey_request capakey = capakey_factory( user= USER, password= PASSWORD ) res = capakey_request(capakey, ListAdmGemeenten, 1) print res 1.3 Using a client behing a proxy If you need to connect to CRAB or CAPAKEY through a proxy, you can do so by passing the proxy parameter to the crabpy.client.crab_factory() or crabpy.client.capakey_factory(). # -*- coding: utf-8 -*- This script show how to connect to the WS-WRAB service through a proxy. 3

from crabpy.client import crab_factory crab = crab_factory( proxy = { http : http://proxy.example.com:3128, https : https://httpsproxy.example.com:3128 } ) print crab.service.listgemeentenbygewestid(1) 1.4 Using the CAPAKEY gateway To make life easier and capakey more pythonic, we ve also implemented a gateway that abstracts some more of the service and provides richer objects as responses. # -*- coding: utf-8 -*- This script demonstrates using the capakey gateway to walk the entire cadastral tree of a gemeente. from crabpy.client import capakey_factory, capakey_request capakey = capakey_factory( user = USER, password = PASSWORD ) from crabpy.gateway.capakey import CapakeyGateway g = CapakeyGateway(capakey) gemeente = g.get_gemeente_by_id(45062) print str(gemeente) for a in gemeente.afdelingen: print "* %s" % a for s in a.secties: print "\t* %s" % s for p in s.percelen: print "\t\t* %s" % p The capakey supports caching through the dogpile caching library. Caching can be added by passing a configuration dictionary to the CapakeyGateway. Three caching regions will be configured: permanent: For requests that can be cached for a very long time, eg. list_gemeenten. long: For requests that can be cached for a fairly long time, eg. list_secties_by_afdeling. short: For requests that will only be cached for a little while, eg. get_perceel_by_capakey. Please bear in mind that in this case short can probably be fairly long. We suspect that the database underlying the capakey service is not updated that regularly, so a short caching duration could easily be one hour or even a day. 4 Chapter 1. Using CRABpy

# -*- coding: utf-8 -*- This script demonstrates querying the capakey gateway while maintaining a cache. import os from crabpy.client import capakey_factory, capakey_request capakey = capakey_factory( user = USER, password = PASSWORD ) from crabpy.gateway.capakey import CapakeyGateway root = "./dogpile_data/" if not os.path.exists(root): os.makedirs(root) g = CapakeyGateway( capakey, cache_config = { permanent.backend : dogpile.cache.dbm, permanent.expiration_time : 604800, permanent.arguments.filename : os.path.join(root, capakey_permanent.dbm ), long.backend : dogpile.cache.dbm, long.expiration_time : 86400, long.arguments.filename : os.path.join(root, capakey_long.dbm ), short.backend : dogpile.cache.dbm, short.expiration_time : 3600, short.arguments.filename : os.path.join(root, capakey_short.dbm ) } ) gent = g.get_gemeente_by_id(44021) print Afdelingen in Gent print ------------------ print [str(a) for a in g.list_kadastrale_afdelingen_by_gemeente(gent)] print Secties in GENT AFD 1 print --------------------- print [str(s) for s in g.list_secties_by_afdeling(44021)] print Percelen in GENT AFD 1, Sectie A print -------------------------------- print [str(p) for p in g.list_percelen_by_sectie(s)] print Perceel 44021A3675/00A000 print ------------------------- p = g.get_perceel_by_capakey( 44021A3675/00A000 ) 1.4. Using the CAPAKEY gateway 5

print perceel: %s % p.id print capakey: %s % p.capakey print percid: %s % p.percid print grondnummer: %s % p.grondnummer print bisnummer: %s % p.bisnummer print exponent: %s % p.exponent print macht: %s % p.macht print sectie: %s % p.sectie print afdeling: %s % p.sectie.afdeling See the examples folder for some more sample code. 6 Chapter 1. Using CRABpy

CHAPTER 2 Development Crabpy is still in alpha development. Currently we re just happy to have gotten a SOAP service working in python. We try to cover as much code as we can with unit tests. You can run them using tox or directly through nose. Currently tox and integration tests with the service don t seem to get along, so we only run integration tests through nose. $ tox # No coverage $ nosetests # Coverage $ nosetests --config nose_cover.cfg If you have access to the capakey service, you can enter your credentials in the nose_development.ini file and use that as a test config. # Integration tests with nose but no coverage $ nosetests --tc-file nose_development.ini # Integration tests with nose and coverage $ nosetests --tc-file nose_development.ini --config nose_cover.cfg 7

8 Chapter 2. Development

CHAPTER 3 API Documentation 3.1 Client module This module contains utiltiy functions for interacting with AGIV soap services. New in version 0.1.0. crabpy.client.capakey_factory(**kwargs) Factory that generates a CAPAKEY client. Return type suds.client.client crabpy.client.capakey_request(client, action, *args) Utility function help 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) Factory that generates a CRAB client. Return type suds.client.client 3.2 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) A Cadastral Division of a Gemeente. class crabpy.gateway.capakey.capakeygateway(client, **kwargs) A gateway to the capakey webservice. get_gemeente_by_id(id) Retrieve a gemeente by id (the NIScode). Return type Gemeente 9

get_kadastrale_afdeling_by_id(id) Retrieve a kadastrale afdeling by id. Parameters id An id of a kadastrale afdeling. Return type A Afdeling. get_perceel_by_capakey(capakey) Get a perceel. Parameters capakey An capakey for a perceel. Return type Perceel get_perceel_by_id_and_sectie(id, sectie) 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) Get a perceel. Parameters percid A percid for a perceel. Return type Perceel get_sectie_by_id_and_afdeling(id, afdeling) 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) List all gemeenten in Vlaanderen. Parameters sort (integer) What field to sort on. Return type A list of Gemeente. list_kadastrale_afdelingen(sort=1) 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) 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. 10 Chapter 3. API Documentation

list_percelen_by_sectie(sectie, sort=1) 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) 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.gemeente(id, naam=none, centroid=none, bounding_box=none, **kwargs) 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) A Cadastral Parcel. class crabpy.gateway.capakey.sectie(id, afdeling, centroid=none, bounding_box=none, **kwargs) A subdivision of a Afdeling. crabpy.gateway.capakey.check_lazy_load_afdeling(f ) Decorator function to lazy load a Afdeling. crabpy.gateway.capakey.check_lazy_load_gemeente(f ) Decorator function to lazy load a Gemeente. crabpy.gateway.capakey.check_lazy_load_perceel(f ) Decorator function to lazy load a Perceel. crabpy.gateway.capakey.check_lazy_load_sectie(f ) Decorator function to lazy load a Sectie. 3.3 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) An exception that signifies something went wrong during authentication. exception crabpy.gateway.exception.gatewayexception(message) A base exception. exception crabpy.gateway.exception.gatewayruntimeexception(message, soapfault) An exception that signifies a soap request went wrong. soapfault = None The soapfault that was generated by the service. 3.3. Gateway exception module 11

3.4 Wsa module This module contains utiltiy functions for using WSA with SOAP services. New in version 0.1.0. class crabpy.wsa.action(action) Assist in rendering a WSA:Action element. class crabpy.wsa.messageid Assist in rendering a WSA:MessageID element. class crabpy.wsa.to(location) Assist in rendering a WSA:To element. 3.5 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) Represents a basic WS-Security token with password digest 12 Chapter 3. API Documentation

CHAPTER 4 History 4.1 0.2.1 (21-02-2014) Document how to connect to the services through a proxy. Fix an incomplete release. 4.2 0.2.0 (03-12-2013) Added a Gateway for the Capakey webservice. Added caching to the Capakey Gateway using Dogpile Better test coverage. Ability to skip integration tests. Added some documentation. Removed a dependency for resolving UsernameDigestTokens. This in term removed the original suds from the dependency chain. Due to removing those dependencies, compatibility with Python 3.2 and 3.3 is now present. 4.3 0.1.0 (25-10-2013) Initial release A working client for the CRAB webservice. A working client for the CapaKey webservice. 13

14 Chapter 4. History

CHAPTER 5 Indices and tables genindex modindex search 15

16 Chapter 5. Indices and tables

Python Module Index c crabpy.client,?? crabpy.gateway.capakey,?? crabpy.gateway.exception,?? crabpy.wsa,?? crabpy.wsse,?? 17