

@decorators.json_view
@account_decorators.login_required
def hostname_geoip(request):
    'AJAX method\n    Retrieves the location of the given hostname using the GEO IP services.\n\n    :param request: HTTP request\n    :return: JSON object, { latitude: $lat, longitude: $lng }\n    '
    hostname = None
    if ('hostname' in request.GET):
        hostname = request.GET['hostname']
    elif ('hostname' in request.POST):
        hostname = request.POST['hostname']
    else:
        json_data = json.loads(request.body)
        if ('hostname' in json_data):
            hostname = json_data['hostname']
        else:
            raise exceptions.BadRequest("'hostname' not found as a parameter of the request.")
    host_ip = socket.gethostbyname(json_data)
    (lat, lng) = gis.get_remote_user_location(ip=host_ip)
    print((((((((('>>> host = ' + str(hostname)) + ', ip = ') + str(host_ip)) + ', @(') + str(lat)) + ', ') + str(lng)) + ')'))
    return {
        'latitude': lat,
        'longitude': lng,
    }

dataset/ETHPy150Open satnet-project/server/services/configuration/ajax/views.py hostname_geoip/VarMisuse@120/250 `hostname`->`json_data`