Merlijn van Deen has uploaded a new change for review. https://gerrit.wikimedia.org/r/80228
Change subject: Make sure all variables passed to request are str ...................................................................... Make sure all variables passed to request are str All parameters passed to request should be bytestrings - str. If any of them is accidentally unicode, this will try to convert all bytestrings to unicode via str.decode(sys.defaultencoding). This is problematic, because non-ascii data will then throw an UnicodeDecodeError as shown in [1]. [1] http://lists.wikimedia.org/pipermail/pywikipedia-l/2013-August/008218.html Change-Id: I1b66a31c8752dee1f950d425d532479f1b671926 --- M wikipedia.py 1 file changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/pywikibot/compat refs/changes/28/80228/1 diff --git a/wikipedia.py b/wikipedia.py index 976a310..4e3a543 100644 --- a/wikipedia.py +++ b/wikipedia.py @@ -6488,12 +6488,12 @@ address = address[:-1] headers = { - 'User-agent': useragent, + 'User-agent': str(useragent), 'Content-Length': str(len(data)), - 'Content-type':contentType, + 'Content-type': str(contentType), } if cookies: - headers['Cookie'] = cookies + headers['Cookie'] = str(cookies) if compress: headers['Accept-encoding'] = 'gzip' @@ -6507,7 +6507,7 @@ retry_attempt = 0 while True: try: - request = urllib2.Request(url, data, headers) + request = urllib2.Request(str(url), str(data), headers) f = MyURLopener.open(request) # read & info can raise socket.error -- To view, visit https://gerrit.wikimedia.org/r/80228 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1b66a31c8752dee1f950d425d532479f1b671926 Gerrit-PatchSet: 1 Gerrit-Project: pywikibot/compat Gerrit-Branch: master Gerrit-Owner: Merlijn van Deen <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
