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 referers = 0
# 1) no pages view --> robot # 1) no pages view --> robot
if not super_hit['viewed_pages']: # if not super_hit['viewed_pages']:
super_hit['robot'] = 1 # super_hit['robot'] = 1
continue # continue
# 2) pages without hit --> robot # 2) pages without hit --> robot
if not super_hit['viewed_hits']: if not super_hit['viewed_hits']:

17
iwla.py
View File

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