This commit is contained in:
Gregory Soutade 2014-11-20 09:37:54 +01:00
parent 8c7f135741
commit 8ba8c99b3c
2 changed files with 9 additions and 14 deletions

View File

@ -11,9 +11,9 @@ def hook(hits):
referers = 0
# 1) no pages view --> robot
if not super_hit['viewed_pages']:
super_hit['robot'] = 1
continue
# if not super_hit['viewed_pages']:
# super_hit['robot'] = 1
# continue
# 2) pages without hit --> robot
if not super_hit['viewed_hits']:

17
iwla.py
View File

@ -12,7 +12,7 @@ from robots import awstats_robots;
print '==> Start'
meta_visit = {'last_time':None}
meta_visit = {}
analyse_started = False
current_visits = {}
cache_plugins = {}
@ -123,7 +123,7 @@ def appendHit(hit):
if status >= 300 and status < 400: return
if super_hit['robot'] or\
not int(hit['status']) in viewed_http_codes:
not status in viewed_http_codes:
page_key = 'not_viewed_pages'
hit_key = 'not_viewed_hits'
else:
@ -271,8 +271,7 @@ def newHit(hit):
cur_time = meta_visit['last_time']
if cur_time == None:
current_visits = deserialize(getDBFilename(t))
if not current_visits: current_visits = createEmptyVisits()
current_visits = deserialize(getDBFilename(t)) or createEmptyVisits()
analyse_started = True
else:
if not analyse_started:
@ -280,12 +279,10 @@ def newHit(hit):
return
else:
analyse_started = True
current_visits = deserialize(getDBFilename(t))
if not current_visits: current_visits = createEmptyVisits()
current_visits = deserialize(getDBFilename(t)) or createEmptyVisits()
if cur_time.tm_mon != t.tm_mon:
generateMonthStats()
current_visits = deserialize(getDBFilename(t))
if not current_visits: current_visits = createEmptyVisits()
current_visits = deserialize(getDBFilename(t)) or createEmptyVisits()
elif cur_time.tm_mday != t.tm_mday:
generateDayStats()
@ -302,9 +299,7 @@ def newHit(hit):
print '==> Analysing log'
meta_visit = deserialize(META_PATH)
if not meta_visit:
meta_visit = createEmptyMeta()
meta_visit = deserialize(META_PATH) or createEmptyMeta()
current_visits = createEmptyVisits()