-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial support for python3 #172
base: master
Are you sure you want to change the base?
Conversation
Not backwards compatible, but possibly could be should someone want to take that on. Modules changed to python3 specific.
@@ -1,4 +1,4 @@ | |||
import ConfigParser | |||
import configparser as ConfigParser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be switched to a try/except
to be backwards compatible
@@ -11,7 +11,7 @@ | |||
import unicodecsv | |||
import threading | |||
from logger import get_logger | |||
from Queue import Queue | |||
import queue as Queue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The module changed here, but just aliased. Again, try/except if you want backwards compatible.
@@ -21,8 +21,8 @@ | |||
import os | |||
import sys | |||
import time | |||
import urllib2 | |||
from cStringIO import StringIO |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now a builtin with io
@@ -70,25 +70,25 @@ def _query(self, path): | |||
url = '%s/lookup/%s' % (self.server, path) | |||
if self.limit: | |||
url += '?limit=%d' % self.limit | |||
req = urllib2.Request(url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to urllib3.
@@ -23,14 +23,14 @@ def reap(file_name): | |||
outbound_url_file = config.get('Reaper', 'outbound_urls') | |||
|
|||
try: | |||
with open(inbound_url_file, 'rb') as f: | |||
with open(inbound_url_file, 'r') as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we're reading string, we need to turn off binary for python3.
@@ -9,5 +9,6 @@ netaddr>=0.7.12,<0.8.0 | |||
pygeoip>=0.3.1,<0.4.0 | |||
requests>=2.10.0,<3.0.0 | |||
sortedcontainers>=0.9.4,<1.6.0 | |||
wsgiref==0.1.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unused anywhere and everything works without it.
unicodecsv>=0.9.4,<0.15.0 | ||
urllib3 | ||
configparser |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python3 version
unicodecsv>=0.9.4,<0.15.0 | ||
urllib3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python3 version
@@ -102,7 +100,7 @@ def process_packetmail(response, source, direction): | |||
data = [] | |||
filter_comments = lambda x: not x[0].startswith('#') | |||
try: | |||
for line in ifilter(filter_comments, | |||
for line in filter(filter_comments, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filter
is now a builtin and replaces itertools.ifilter. Not sure how we'd make this backward compatible.
Hi, do you have the modified script for py3? or any place where thr is documentation on how to install it correctly. |
@ptester87 its in my fork. |
Not backwards compatible, but possibly could be should someone want to
take that on.
Modules changed to python3 specific.
Ref #171