Revision: 7156 Author: alexsh Date: 2009-08-16 14:14:15 +0000 (Sun, 16 Aug 2009)
Log Message: ----------- add config.authenticate into getData
Modified Paths: -------------- trunk/pywikipedia/query.py
Modified: trunk/pywikipedia/query.py =================================================================== --- trunk/pywikipedia/query.py 2009-08-16 14:07:10 UTC (rev 7155) +++ trunk/pywikipedia/query.py 2009-08-16 14:14:15 UTC (rev 7156) @@ -86,7 +86,13 @@ while retryCount >= 0: try: jsontext = "Nothing received" - if params['action'] in postAC: + if site.hostname() in wikipedia.config.authenticate.keys(): + predata["Content-type"] = "application/x-www-form-urlencoded" + predata["User-agent"] = useragent + data = site.urlEncode(params) + res = urllib2.urlopen(urllib2.Request(site.protocol() + '://' + site.hostname() + address, data)) + jsontext = res.read() + elif params['action'] in postAC: res, jsontext = site.postData(path, urllib.urlencode(params.items()), cookies=site.cookies(sysop=sysop), sysop=sysop) else: if back_response: