Revision: 7587 Author: alexsh Date: 2009-11-03 11:59:53 +0000 (Tue, 03 Nov 2009)
Log Message: ----------- handle response code in MyURLopener for python 2.5, thanks for sbrhsieh@ptt.cc.
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2009-11-03 11:56:50 UTC (rev 7586) +++ trunk/pywikipedia/wikipedia.py 2009-11-03 11:59:53 UTC (rev 7587) @@ -8090,6 +8090,15 @@ raise PageNotFound(u'Page %s could not be retrieved. Check your family file ?' % url) else: return urllib.FancyURLopener.http_error_default(self, url, fp, errcode, errmsg, headers) + + def open_http(self, url, data=None): + ret = urllib.FancyURLopener.open_http(self, url, data) + if hasattr(self, 'http_code'): + ret.status = self.http_code + del self.http_code + else: + ret.status = 200 + return ret