]> projects.mako.cc - python-simplemediawiki.debian/blobdiff - simplemediawiki.py
merge patched into master
[python-simplemediawiki.debian] / simplemediawiki.py
index e123a5b5295a07d9e81e56a8cbc59736a3a4f99c..ec12a11754d8efdb157e68435a5335ac9c86e030 100644 (file)
@@ -33,7 +33,7 @@ of namespaces are provided for your convenience.
 
 import cookielib
 import gzip
-import iso8601.iso8601 as iso8601
+import iso8601
 import json
 from StringIO import StringIO
 import urllib
@@ -55,7 +55,6 @@ class MediaWiki():
     _high_limits = None
     _namespaces = None
     _psuedo_namespaces = None
-    _mediawiki_version = None
 
     def __init__(self, api_url, cookie_file=None, user_agent=DEFAULT_UA):
         self._api_url = api_url
@@ -74,6 +73,10 @@ class MediaWiki():
         self._opener.addheaders = [('User-agent', user_agent)]
 
     def _fetch_http(self, url, params):
+        """
+        Standard HTTP request handler for this class with gzip and cookie
+        support.
+        """
         request = urllib2.Request(url, urllib.urlencode(params))
         request.add_header('Accept-encoding', 'gzip')
         response = self._opener.open(request)
@@ -107,17 +110,9 @@ class MediaWiki():
             in order to test whether the given URL will return JSON.
             """
             data = self._fetch_http(api_url, {'action': 'query',
-                                              'meta': 'siteinfo',
-                                              'siprop': 'general',
-                                              'format': 'json'})
+                                              'meta': 'siteinfo'})
             try:
                 data_json = json.loads(data)
-                # may as well set the version
-                try:
-                    version_string = data_json['query']['general']['generator']
-                    self._mediawiki_version = version_string.split(' ', 1)[1]
-                except KeyError:
-                    pass
                 return (data, data_json)
             except ValueError:
                 return (data, None)

Benjamin Mako Hill || Want to submit a patch?