Skip to content

Commit

Permalink
[web,movie] Unicode and Python3 fixes
Browse files Browse the repository at this point in the history
web.py now makes sure to quote url parameters before passing them to urllib.

This commit also fixes movie.py to properly handle unicode, fixes
web.quote to properly handle unicode and python3 andfixes web.urlencode for
python3.

Thanks to Erethon on freenode for showing me the url issue.
  • Loading branch information
Elad Alfassa committed Mar 1, 2014
1 parent 6e33128 commit 95c3e37
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions movie.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ def movie(bot, trigger):
word = trigger.group(2).rstrip()
word = word.replace(" ", "+")
uri = "http://www.imdbapi.com/?t=" + word
u = web.get_urllib_object(uri, 30)
data = json.load(u) # data is a Dict containing all the information we need
u.close()
u = web.get(uri, 30)
data = json.loads(u.decode()) # data is a Dict containing all the information we need
if data['Response'] == 'False':
if 'Error' in data:
message = '[MOVIE] %s' % data['Error']
Expand Down

0 comments on commit 95c3e37

Please sign in to comment.