Update code for Python3
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
#
|
||||
|
||||
from iwla import IWLA
|
||||
from istats_diff import IWLADisplayStatsDiff
|
||||
from .istats_diff import IWLADisplayStatsDiff
|
||||
from display import *
|
||||
|
||||
"""
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#
|
||||
|
||||
from iwla import IWLA
|
||||
from istats_diff import IWLADisplayStatsDiff
|
||||
from .istats_diff import IWLADisplayStatsDiff
|
||||
from display import *
|
||||
|
||||
"""
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#
|
||||
|
||||
from iwla import IWLA
|
||||
from istats_diff import IWLADisplayStatsDiff
|
||||
from .istats_diff import IWLADisplayStatsDiff
|
||||
from display import *
|
||||
|
||||
"""
|
||||
|
@@ -21,7 +21,7 @@
|
||||
from iwla import IWLA
|
||||
from iplugin import IPlugin
|
||||
|
||||
from iptogeo import IPToGeo
|
||||
from .iptogeo import IPToGeo
|
||||
|
||||
"""
|
||||
Post analysis hook
|
||||
@@ -88,7 +88,7 @@ class IWLAPostAnalysisIPToGeo(IPlugin):
|
||||
geo[cc] += 1
|
||||
else:
|
||||
geo[cc] = 1
|
||||
except Exception, e:
|
||||
print e
|
||||
except Exception as e:
|
||||
print(e)
|
||||
|
||||
month_stats['geo'] = geo
|
||||
|
@@ -81,7 +81,7 @@ class IPToGeo(object):
|
||||
return res
|
||||
|
||||
def _create_request(self, ip, ip_type):
|
||||
packet = ''
|
||||
packet = b''
|
||||
packet += struct.pack('<IBBBBI', IPToGeo.MAGIC, IPToGeo.VERSION, IPToGeo.REQ,
|
||||
0, #err
|
||||
ip_type, # ip type
|
||||
@@ -124,7 +124,7 @@ class IPToGeo(object):
|
||||
if not packet:
|
||||
raise socket.timeout
|
||||
return packet
|
||||
except socket.timeout, e:
|
||||
except socket.timeout as e:
|
||||
if second_chance:
|
||||
self._nb_requests_sent = self.MAX_REQUESTS
|
||||
return self._send_request(packet, False)
|
||||
|
@@ -78,7 +78,7 @@ class IWLAPostAnalysisReferers(IPlugin):
|
||||
domain_name = self.iwla.getConfValue('domain_name', '')
|
||||
|
||||
if not domain_name:
|
||||
print 'domain_name must not be empty !'
|
||||
print('domain_name must not be empty !')
|
||||
return False
|
||||
|
||||
self.own_domain_re = re.compile(r'.*%s.*' % (domain_name))
|
||||
@@ -114,7 +114,7 @@ class IWLAPostAnalysisReferers(IPlugin):
|
||||
key_phrase = groups.groupdict()['key_phrase']
|
||||
try:
|
||||
key_phrase = urllib.unquote_plus(key_phrase).decode('utf8')
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
continue
|
||||
if not key_phrase in key_phrases.keys():
|
||||
|
@@ -59,11 +59,11 @@ class IWLAPreAnalysisPageToHit(IPlugin):
|
||||
def load(self):
|
||||
# Page to hit
|
||||
self.ph_regexps = self.iwla.getConfValue('page_to_hit_conf', [])
|
||||
self.ph_regexps = map(lambda(r): re.compile(r), self.ph_regexps)
|
||||
self.ph_regexps = map(lambda r: re.compile(r), self.ph_regexps)
|
||||
|
||||
# Hit to page
|
||||
self.hp_regexps = self.iwla.getConfValue('hit_to_page_conf', [])
|
||||
self.hp_regexps = map(lambda(r): re.compile(r), self.hp_regexps)
|
||||
self.hp_regexps = map(lambda r: re.compile(r), self.hp_regexps)
|
||||
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
return True
|
||||
|
@@ -60,7 +60,7 @@ class IWLAPreAnalysisRobots(IPlugin):
|
||||
self.API_VERSION = 1
|
||||
|
||||
def load(self):
|
||||
self.awstats_robots = map(lambda (x) : re.compile(('.*%s.*') % (x), re.IGNORECASE), awstats_data.robots)
|
||||
self.awstats_robots = map(lambda x : re.compile(('.*%s.*') % (x), re.IGNORECASE), awstats_data.robots)
|
||||
self.robot_re = re.compile(r'.*bot.*', re.IGNORECASE)
|
||||
self.crawl_re = re.compile(r'.*crawl.*', re.IGNORECASE)
|
||||
self.logger = logging.getLogger(self.__class__.__name__)
|
||||
|
Reference in New Issue
Block a user