Skip to content

Conversation

robgil
Copy link

@robgil robgil commented Dec 26, 2017

Not backwards compatible, but possibly could be should someone want to
take that on.

Modules changed to python3 specific.

Ref #171

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
Copy link
Author

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

import threading
from logger import get_logger
from Queue import Queue
import queue as Queue
Copy link
Author

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.

import sys
import time
import urllib2
from cStringIO import StringIO
Copy link
Author

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

url = '%s/lookup/%s' % (self.server, path)
if self.limit:
url += '?limit=%d' % self.limit
req = urllib2.Request(url)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched to urllib3.


try:
with open(inbound_url_file, 'rb') as f:
with open(inbound_url_file, 'r') as f:
Copy link
Author

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.

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
Copy link
Author

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.

wsgiref==0.1.2
unicodecsv>=0.9.4,<0.15.0
urllib3
configparser
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python3 version

sortedcontainers>=0.9.4,<1.6.0
wsgiref==0.1.2
unicodecsv>=0.9.4,<0.15.0
urllib3
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python3 version

filter_comments = lambda x: not x[0].startswith('#')
try:
for line in ifilter(filter_comments,
for line in filter(filter_comments,
Copy link
Author

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.

@ptester87
Copy link

Hi, do you have the modified script for py3? or any place where thr is documentation on how to install it correctly.

@robgil
Copy link
Author

robgil commented Dec 13, 2018

@ptester87 its in my fork.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants