debian/0000755000000000000000000000000011740662066007176 5ustar debian/copyright0000644000000000000000000000152311740657426011136 0ustar This work was packaged for Debian by: Benjamin Mako Hill on Fri, 11 Feb 2011 00:31:20 -0500 It was downloaded from: http://pypi.python.org/pypi/simplemediawiki http://github.com/ianweller/python-simplemediawikiOB Upstream Author: Ian Weller Copyright: Copyright (C) 2010 Red Hat, Inc. License: This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free # Software Foundation; either version 2.1 of the License, or (at your option) any later version. On Debian systems, the complete text of the GNU Lesser General Public License version 2.1 can be found in: "/usr/share/common-licenses/LGPL-2.1". The Debian packaging is: Copyright (C) 2011 Benjamin Mako Hill debian/changelog0000644000000000000000000000066011740661140011042 0ustar python-simplemediawiki (1.0.2-2) unstable; urgency=low * Fix dependencies. (Closes: #645164) * Bump standards version. * Add debian/rules clean target to clean up from new build. -- Benjamin Mako Hill Mon, 09 Apr 2012 18:16:28 -0400 python-simplemediawiki (1.0.2-1) unstable; urgency=low * Initial release. (Closes: #613133) -- Benjamin Mako Hill Mon, 09 Apr 2012 18:15:04 -0400 debian/control0000644000000000000000000000213311740661027010574 0ustar Source: python-simplemediawiki Section: python Priority: extra Maintainer: Benjamin Mako Hill Build-Depends: cdbs, debhelper (>= 7.0.50~), python (>=2.6), python-support Standards-Version: 3.9.3 Homepage: https://github.com/ianweller/python-simplemediawiki XS-Python-Version: >= 2.6 Package: python-simplemediawiki Architecture: all Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends} Provides: ${python:Provides} XB-Python-Version: ${python:Versions} Description: extremely low-level Python wrapper to the MediaWiki API SimpleMediawiki is an extremely low-level wrapper to the MediaWiki API. It automatically handles cookies and gzip compression so that you can make basic calls to the API in the easiest way possible. It also provides a few functions to make day-to-day API access easier. . To use this module, instantiate a MediaWiki object, passing it the URL of api.php for the wiki you want to work with. Calls go through MediaWiki.call(). A generic login wrapper as well as functions to determine limits and get a list of namespaces are provided for your convenience. debian/patches/0000755000000000000000000000000011740657426010631 5ustar debian/patches/0004-There-s-no-good-way-to-import-iso8601-apparently.patch0000644000000000000000000000117111740657426023114 0ustar From efa6e86fcf1586602e39253bca8a7abf5de34efe Mon Sep 17 00:00:00 2001 From: Ian Weller Date: Sat, 5 Feb 2011 00:00:31 -0600 Subject: There's no good way to import iso8601, apparently --- simplemediawiki.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/simplemediawiki.py b/simplemediawiki.py index e123a5b..f039c5a 100644 --- a/simplemediawiki.py +++ b/simplemediawiki.py @@ -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 debian/patches/0005-Add-docstring-to-_fetch_http.patch0000644000000000000000000000150411740657426017623 0ustar From bed00dea090ba51e33981e0b6784f23253d4f74a Mon Sep 17 00:00:00 2001 From: Ian Weller Date: Sat, 5 Feb 2011 00:00:46 -0600 Subject: Add docstring to _fetch_http --- simplemediawiki.py | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/simplemediawiki.py b/simplemediawiki.py index f039c5a..2934ab9 100644 --- a/simplemediawiki.py +++ b/simplemediawiki.py @@ -74,6 +74,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) debian/patches/series0000644000000000000000000000052611740657426012051 0ustar 0001-Fix-not-being-able-to-import-the-module.patch 0002-Import-iso8601-in-a-way-that-makes-pylint-happy.patch 0003-Refactor-normalize_api_url.patch 0004-There-s-no-good-way-to-import-iso8601-apparently.patch 0005-Add-docstring-to-_fetch_http.patch 0006-Forget-about-version-checking-for-right-now.patch 0007-use-setuptools-if-available.patch debian/patches/0002-Import-iso8601-in-a-way-that-makes-pylint-happy.patch0000644000000000000000000000120411740657426022717 0ustar From 9ce74c8ebc5ac8ee818ec122c89531b1d1b4c9ac Mon Sep 17 00:00:00 2001 From: Ian Weller Date: Fri, 4 Feb 2011 22:10:54 -0600 Subject: Import iso8601 in a way that makes pylint happy --- simplemediawiki.py | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/simplemediawiki.py b/simplemediawiki.py index 6bdd944..ff879ed 100644 --- a/simplemediawiki.py +++ b/simplemediawiki.py @@ -33,7 +33,7 @@ of namespaces are provided for your convenience. import cookielib import gzip -from iso8601 import iso8601 +import iso8601.iso8601 as iso8601 import json from StringIO import StringIO import urllib debian/patches/0001-Fix-not-being-able-to-import-the-module.patch0000644000000000000000000000205711740657426021534 0ustar From a54cc1e6cdfacf678711f6c88021c8eca5c6580c Mon Sep 17 00:00:00 2001 From: Ian Weller Date: Fri, 4 Feb 2011 22:06:35 -0600 Subject: Fix not being able to import the module --- simplemediawiki.py | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/simplemediawiki.py b/simplemediawiki.py index ab0f3f7..6bdd944 100644 --- a/simplemediawiki.py +++ b/simplemediawiki.py @@ -39,6 +39,12 @@ from StringIO import StringIO import urllib import urllib2 +__author__ = 'Ian Weller ' +__version__ = '1.0.2' +DEFAULT_UA = ('python-simplemediawiki/%s ' + '+https://github.com/ianweller/python-simplemediawiki') \ + % __version__ + class MediaWiki(): """ @@ -206,10 +212,3 @@ class MediaWiki(): objects. """ return iso8601.parse_date(date) - - -__author__ = 'Ian Weller ' -__version__ = '1.0.2' -DEFAULT_UA = 'python-simplemediawiki/%s ' + \ - '+https://github.com/ianweller/python-simplemediawiki' \ - % __version__ debian/patches/0006-Forget-about-version-checking-for-right-now.patch0000644000000000000000000000311311740657426022525 0ustar From 49b148ee4c10fdf671288331217bd4dd0304b8b4 Mon Sep 17 00:00:00 2001 From: Ian Weller Date: Sat, 5 Feb 2011 00:31:07 -0600 Subject: Forget about version checking for right now --- simplemediawiki.py | 11 +---------- 1 files changed, 1 insertions(+), 10 deletions(-) diff --git a/simplemediawiki.py b/simplemediawiki.py index 2934ab9..ec12a11 100644 --- a/simplemediawiki.py +++ b/simplemediawiki.py @@ -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 @@ -111,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) debian/patches/0007-use-setuptools-if-available.patch0000644000000000000000000000162611740657426017570 0ustar From b1031465666db28694e2eb69c81d9ce33857f09a Mon Sep 17 00:00:00 2001 From: Benjamin Mako Hill Date: Mon, 9 Apr 2012 18:13:37 -0400 Subject: use setuptools if available --- setup.py | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 79a2b1e..fb1768e 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,8 @@ -from distutils.core import setup +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + setup(name='simplemediawiki', version='1.0.2', description='Extremely low-level wrapper to the MediaWiki API', @@ -11,7 +15,7 @@ setup(name='simplemediawiki', 'License :: OSI Approved :: GNU Library or Lesser General Public ' 'License (LGPL)', ], - requires=[ + install_requires=[ 'iso8601', ], py_modules=['simplemediawiki']) debian/patches/0003-Refactor-normalize_api_url.patch0000644000000000000000000000616711740657426017522 0ustar From de97f3ccde6527ac63bde701ae759291d93d1aa4 Mon Sep 17 00:00:00 2001 From: Ian Weller Date: Fri, 4 Feb 2011 23:58:26 -0600 Subject: Refactor normalize_api_url --- simplemediawiki.py | 42 +++++++++++++++++++++++------------------- 1 files changed, 23 insertions(+), 19 deletions(-) diff --git a/simplemediawiki.py b/simplemediawiki.py index ff879ed..e123a5b 100644 --- a/simplemediawiki.py +++ b/simplemediawiki.py @@ -101,7 +101,28 @@ class MediaWiki(): returns that URL, while also helpfully setting this object's API URL to it. If it can't magically conjure an API endpoint, it returns False. """ - data, data_json = self._normalize_api_url_tester(self._api_url) + def tester(self, api_url): + """ + Attempts to fetch general information about the MediaWiki instance + 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'}) + 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) + + data, data_json = tester(self, self._api_url) if data_json: return self._api_url else: @@ -109,30 +130,13 @@ class MediaWiki(): if 'index.php' in self._api_url: test_api_url = self._api_url.split('index.php')[0] + 'api.php' print test_api_url - test_data, test_data_json = \ - self._normalize_api_url_tester(test_api_url) + test_data, test_data_json = tester(self, test_api_url) print (test_data, test_data_json) if test_data_json: self._api_url = test_api_url return self._api_url return False - def _normalize_api_url_tester(self, api_url): - data = self._fetch_http(api_url, {'action': 'query', - 'meta': 'siteinfo', - 'siprop': 'general', - 'format': 'json'}) - 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) def login(self, user, passwd, token=None): """ debian/source/0000755000000000000000000000000011740657426010502 5ustar debian/source/format0000644000000000000000000000001411740657426011710 0ustar 3.0 (quilt) debian/compat0000644000000000000000000000000211740657426010400 0ustar 7 debian/watch0000644000000000000000000000013711740657426010234 0ustar version=3 http://pypi.python.org/packages/source/s/simplemediawiki/simplemediawiki-(.*).tar.gz debian/rules0000755000000000000000000000024011740661561010251 0ustar #!/usr/bin/make -f include /usr/share/cdbs/1/rules/debhelper.mk include /usr/share/cdbs/1/class/python-distutils.mk clean:: rm -rf simplemediawiki.egg-info