# HG changeset patch # User Jeff Hammel # Date 1606243007 28800 # Node ID 676ff92e2b1e3292f2a6591da0c5a839b3380904 # Parent bad7e66f4f2449732cb185bdb1f76af40f3e7d2a py3 diff -r bad7e66f4f24 -r 676ff92e2b1e wordstream/handlers.py --- 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()