summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2011-09-27 18:08:46 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2011-09-27 18:08:55 +0200
commit152c8564e92766bc294bfbb7ed81281b653e6760 (patch)
tree55ccbd676abea77dfda01dc0a33a16b4e98c0d23
parent1398da5d22c4869e39e3666f6187f2710b1d7315 (diff)
downloadsites-152c8564e92766bc294bfbb7ed81281b653e6760.tar.gz
sites-152c8564e92766bc294bfbb7ed81281b653e6760.tar.bz2
sites-152c8564e92766bc294bfbb7ed81281b653e6760.zip
do not fail if reverse dns is not available
-rwxr-xr-xindex.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/index.py b/index.py
index c0a38f9..7e82cdf 100755
--- a/index.py
+++ b/index.py
@@ -86,8 +86,13 @@ class new:
return False
def get_user_information(self):
+ try:
+ host = gethostbyaddr(ctx.ip)[0]
+ except:
+ host = ctx.ip
+
return {'ip': ctx.ip,
- 'host': gethostbyaddr(ctx.ip)[0],
+ 'host': host,
'valid': self.validate(ctx.ip)}
def GET(self):