9.3. webgeocoder

9.3.1. Module Contents

9.3.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.

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'
DESCRIPTION = 'Geolocator service via a http request. Use a subclass of this plugin and implement the make_call...'
PARAM_DEFS
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.'
DESCRIPTION = 'Geolocator service via a http GET request.'
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.'
DESCRIPTION = 'Geolocator service via a http POST request.'
make_call(base_url, request_string='')