:py:mod:`webgeocoder` ===================== .. py:module:: webgeocoder Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: webgeocoder.HttpGeocoder webgeocoder.HttpGetGeocoder webgeocoder.HttpPostGeocoder .. py:class:: HttpGeocoder Bases: :py:obj:`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. .. py:attribute:: NAME :value: 'Http geocoder plugin' .. py:attribute:: DESCRIPTION :value: 'Geolocator service via a http request. Use a subclass of this plugin and implement the make_call...' .. py:attribute:: PARAM_DEFS .. py:attribute:: REQUEST_TEMPLATE :value: '' .. py:attribute:: REQUEST_HEADERS .. py:method:: init(geocoder_vars) .. py:method:: get_request_headers() .. py:method:: before_request() Before running actual request to service .. py:method:: after_request() After running actual request to service .. py:method:: get_request_string() .. py:method:: run_request(ip) Prepare actual request to service .. py:method:: make_call(base_url, request_string) .. py:method:: perform_request(ip) .. py:method:: parse_result() .. py:method:: 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. .. py:class:: HttpGetGeocoder Bases: :py:obj:`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. .. py:attribute:: NAME :value: 'Http geocoder plugin based on a GET request.' .. py:attribute:: DESCRIPTION :value: 'Geolocator service via a http GET request.' .. py:method:: make_call(base_url, request_string='') .. py:class:: HttpPostGeocoder Bases: :py:obj:`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. .. py:attribute:: NAME :value: 'Http geocoder plugin based on a POST request.' .. py:attribute:: DESCRIPTION :value: 'Geolocator service via a http POST request.' .. py:method:: make_call(base_url, request_string='')