Created
March 27, 2013 09:26
-
-
Save ykhrustalev/5252944 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source http://small-code.blogspot.ru/2008/05/nslookup-in-python.html | |
from socket import gethostbyaddr | |
def nslooky(ip): | |
try: | |
output = gethostbyaddr(ip) | |
return output[0] | |
except: | |
output = "not found" | |
return output | |
your_ip = request.META.get('REMOTE_ADDR') | |
# above is Django module object | |
your_name = nslooky(your_ip) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment