[Pywikipedia-l] SVN: [5761] branches/rewrite/pywikibot/data/api.py
nicdumz at svn.wikimedia.org
nicdumz at svn.wikimedia.org
Sat Jul 26 08:36:01 UTC 2008
Revision: 5761
Author: nicdumz
Date: 2008-07-26 08:36:01 +0000 (Sat, 26 Jul 2008)
Log Message:
-----------
Decode rawdata if not unicode
Modified Paths:
--------------
branches/rewrite/pywikibot/data/api.py
Modified: branches/rewrite/pywikibot/data/api.py
===================================================================
--- branches/rewrite/pywikibot/data/api.py 2008-07-25 22:59:42 UTC (rev 5760)
+++ branches/rewrite/pywikibot/data/api.py 2008-07-26 08:36:01 UTC (rev 5761)
@@ -183,12 +183,13 @@
else:
uri = uri + "?" + params
rawdata = http.request(self.site, uri)
- rawdata = rawdata.decode(self.site.encoding())
except Exception, e: #TODO: what exceptions can occur here?
logger.warning(traceback.format_exc())
print uri, params
self.wait()
continue
+ if not isinstance(rawdata, unicode):
+ rawdata = rawdata.decode(self.site.encoding)
if rawdata.startswith(u"unknown_action"):
raise APIError(rawdata[:14], rawdata[16:])
try:
More information about the Pywikipedia-l
mailing list