@decorators.json_view
@account_decorators.login_required
def hostname_geoip(request):
    # noinspection PyUnusedLocal
    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(hostname)
    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}
Test that sorting works on a valid graph with one possible order.
dataset/ETHPy150Open satnet-project/server/services/configuration/ajax/views.py/hostname_geoip--crossover with--dataset/ETHPy150Open adblockplus/gyp/pylib/gyp/common_test.py/TestTopologicallySorted.test_Valid