34 GeolocatorBase.__init__(self)
35 self.
_url =
'http://ip-api.com/json/'
47 err =
'No IP provided'
51 response = self._http_request.perform_request(self.
_url + req.ip)
52 except RappError
as err:
53 RappUtilities.rapp_print(err,
'ERROR')
56 if response[
'status'] !=
'success':
57 err =
'Http request failed: ' + response[
'message']
58 RappUtilities.rapp_print(err,
'ERROR')
65 except RappError
as err:
66 RappUtilities.rapp_print(err,
'ERROR')
77 keys = {
'city':
'city',
79 'countryCode':
'countryCode',
82 'regionName':
'regionName',
83 'timezone':
'timezone',
87 return self.rapp_http_json_parser.find_values(keys, response)
Base class for geolocators.
_url
The base geolocator url.
def _handle_server_response
Handles the server's response.
def fetch_geolocation
Fetch the location.