Skip to content

Commit 7100fed

Browse files
author
Steve Herschleb
committed
include Python3 updates
2 parents 42f7062 + 3c58cca commit 7100fed

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

alchemyapi.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
try:
55
from urllib.request import urlopen
66
from urllib.parse import urlparse
7-
from urllib.quote import urlquote
7+
from urllib.parse import quote as urlquote
88
except ImportError:
99
from urlparse import urlparse
1010
from urllib2 import urlopen
@@ -571,9 +571,8 @@ def __analyze(self, url, options):
571571

572572
try:
573573
#build the request with uri encoding
574-
req = urlparse(url)
575-
page = urlopen(req.geturl())
576-
return json.load(page)
574+
page = urlopen(url).read().decode("utf-8")
575+
return json.loads(page)
577576
except Exception as e:
578577
print('error for url: ', url)
579578
print(e)

0 commit comments

Comments
 (0)