9.1. webgeocoder

9.1.1. Classes

HttpGeocoder

A base class for geocoders on the web.

HttpGetGeocoder

A geocoder plugin using a http GET request.

HttpPostGeocoder

A geocoder plugin using a http POST request.

9.1.2. Module Contents

class webgeocoder.HttpGeocoder

Bases: GeoHealthCheck.geocoder.Geocoder

A base class for geocoders on the web.

It is intended to use a subclass of this class and implement the make_call method.

NAME = 'Http geocoder plugin'

Short name of Plugin. TODO: i18n e.g. NAME_nl_NL ?

DESCRIPTION = 'Geolocator service via a http request. Use a subclass of this plugin and implement the...

Longer description of Plugin. TODO: optional i18n e.g. DESCRIPTION_de_DE ?

PARAM_DEFS

Plugin Parameter definitions.

REQUEST_TEMPLATE = ''
REQUEST_HEADERS
init(geocoder_vars)
get_request_headers()
before_request()

Before running actual request to service

after_request()

After running actual request to service

get_request_string()
run_request(ip)

Prepare actual request to service

make_call(base_url, request_string)
perform_request(ip)
parse_result()
locate(ip)

Class method to create and run a single Probe instance. Follows strict sequence of method calls. Each method can be overridden in subclass.

class webgeocoder.HttpGetGeocoder

Bases: HttpGeocoder

A geocoder plugin using a http GET request.

Use the init method (not the dunder methode) to initialise the geocoder. Provide a dict with keys: geocoder_url, lat_field, lon_field, and optional template and parameters. The geocoder_url parameter should include {hostname} where the locate function will substitute the server name that needs to be located. The lat_field and lon_field parameters specify the field names of the lat/lon in the json response.

NAME = 'Http geocoder plugin based on a GET request.'

Short name of Plugin. TODO: i18n e.g. NAME_nl_NL ?

DESCRIPTION = 'Geolocator service via a http GET request.'

Longer description of Plugin. TODO: optional i18n e.g. DESCRIPTION_de_DE ?

make_call(base_url, request_string='')
class webgeocoder.HttpPostGeocoder

Bases: HttpGeocoder

A geocoder plugin using a http POST request.

Use the init method (not the dunder methode) to initialise the geocoder. Provide a dict with keys: geocoder_url, lat_field, lon_field, and optional template and parameters. The geocoder_url parameter should include {hostname} where the locate function will substitute the server name that needs to be located. The lat_field and lon_field parameters specify the field names of the lat/lon in the json response.

NAME = 'Http geocoder plugin based on a POST request.'

Short name of Plugin. TODO: i18n e.g. NAME_nl_NL ?

DESCRIPTION = 'Geolocator service via a http POST request.'

Longer description of Plugin. TODO: optional i18n e.g. DESCRIPTION_de_DE ?

make_call(base_url, request_string='')