mediawiki backend: Use readurl instead of openurl

So that requests can be shown and saved if the debug options are activated.
json.load(fp) is just calling json.loads(fp.read) so there is no
performance loss.
This commit is contained in:
Laurent Bachelier 2011-04-14 00:38:24 +02:00 committed by Romain Bignon
commit 44f6189ca5

View file

@ -169,11 +169,11 @@ class MediawikiBrowser(BaseBrowser):
'''Submit a GET request to the website
The JSON data is parsed and returned as a dictionary'''
data['format'] = 'json'
return simplejson.load(self.openurl(self.buildurl(self.apiurl, **data)), 'utf-8')
return simplejson.loads(self.readurl(self.buildurl(self.apiurl, **data)), 'utf-8')
def API_post(self, data):
'''Submit a POST request to the website
The JSON data is parsed and returned as a dictionary'''
data['format'] = 'json'
return simplejson.load(self.openurl(self.apiurl, urllib.urlencode(data)), 'utf-8')
return simplejson.loads(self.readurl(self.apiurl, urllib.urlencode(data)), 'utf-8')