changeset 11:676ff92e2b1e

py3
author Jeff Hammel <k0scist@gmail.com>
date Tue, 24 Nov 2020 10:36:47 -0800
parents bad7e66f4f24
children 5a45f0c4cb87
files wordstream/handlers.py
diffstat 1 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/wordstream/handlers.py	Tue Nov 24 10:33:22 2020 -0800
+++ b/wordstream/handlers.py	Tue Nov 24 10:36:47 2020 -0800
@@ -3,22 +3,24 @@
 these are instantiated for every request, then called
 """
 
-import urllib2
+from urllib2.request import urlopen
 
 from pprint import pprint
 from urlparse import urlparse
 from webob import Response, exc
 from StringIO import StringIO
-from wordstream.api import Corpus
-from wordstream.dissociate import dissociate
+from .api import Corpus
+from .dissociate import dissociate
+
 
 class HandlerMatchException(Exception):
     """the handler doesn't match the request"""
 
+
 class Handler(object):
 
     methods = set(['GET']) # methods to listen to
-    handler_path = [] # path elements to match        
+    handler_path = [] # path elements to match
 
     @classmethod
     def match(cls, app, request):
@@ -159,7 +161,7 @@
         return GenshiHandler.Get(self)
 
     def url_contents(self, url):
-        return urllib2.urlopen(url).read()
+        return urlopen(url).read()
 
     def dissociation(self, contents):
         corpus = Corpus()