def whois_host(request): ip = request.META['REMOTE_ADDR'] try: ctx = {'what': psl.get_public_suffix(gethostbyaddr(request.META['REMOTE_ADDR'])[0])} except herror: ctx = {'what': '(hostname unavailable)', 'data': "Hostname not found"} else: ctx['data'] = shell.whois(ctx['what']).stdout return render_to_response('ip_info/whois.html', ctx)
def whois_ip(request): ctx = {'what': request.META['REMOTE_ADDR']} ctx['data'] = shell.whois(request.META['REMOTE_ADDR']).stdout return render_to_response('ip_info/whois.html', ctx)