Metadata-Version: 2.1
Name: pymediawiki
Version: 0.7.1
Summary: Wikipedia and MediaWiki API wrapper for Python
Home-page: attr: mediawiki.__url__
Author: attr: mediawiki.__author__
Author-email: attr: mediawiki.__email__
License: attr: mediawiki.__license__
Download-URL: attr: mediawiki.__download_url__
Keywords: python,mediawiki,wikipedia,API,wiki,parser,natural language processing,nlp
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Classifier: Topic :: Internet
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content :: Wiki
Classifier: License :: OSI Approved
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Requires-Python: >=3.4
License-File: LICENSE
Requires-Dist: beautifulsoup4
Requires-Dist: requests (<3.0.0,>=2.0.0)

MediaWiki
=========

.. image:: https://img.shields.io/badge/license-MIT-blue.svg
    :target: https://opensource.org/licenses/MIT/
    :alt: License
.. image:: https://img.shields.io/github/release/barrust/mediawiki.svg
    :target: https://github.com/barrust/mediawiki/releases
    :alt: GitHub release
.. image:: https://github.com/barrust/mediawiki/workflows/Python%20package/badge.svg
    :target: https://github.com/barrust/mediawiki/actions?query=workflow%3A%22Python+package%22
    :alt: Build Status
.. image:: https://codecov.io/gh/barrust/mediawiki/branch/master/graph/badge.svg?token=OdETiNgz9k
    :target: https://codecov.io/gh/barrust/mediawiki
    :alt: Test Coverage
.. image:: https://api.codacy.com/project/badge/Grade/afa87d5f5b6e4e66b78e15dedbc097ec
    :target: https://www.codacy.com/app/barrust/mediawiki?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=barrust/mediawiki&amp;utm_campaign=Badge_Grade
    :alt: Codacy Review
.. image:: https://badge.fury.io/py/pymediawiki.svg
    :target: https://badge.fury.io/py/pymediawiki
    :alt: PyPi Release
.. image:: http://pepy.tech/badge/pymediawiki
    :target: http://pepy.tech/count/pymediawiki
    :alt: Downloads

***mediawiki*** is a python wrapper and parser for the MediaWiki API. The goal
is to allow users to quickly and efficiently pull data from the MediaWiki site
of their choice instead of worrying about dealing directly with the API. As
such, it does not force the use of a particular MediaWiki site. It defaults to
`Wikipedia <http://www.wikipedia.org>`__ but other MediaWiki sites can
also be used.

MediaWiki wraps the `MediaWiki API <https://www.mediawiki.org/wiki/API>`_
so you can focus on *leveraging* your favorite MediaWiki site's data,
not getting it. Please check out the code on
`github <https://www.github.com/barrust/mediawiki>`_!

**Note:** this library was designed for ease of use and simplicity. If you plan
on doing serious scraping, automated requests, or editing, please look into
`Pywikibot <https://www.mediawiki.org/wiki/Manual:Pywikibot>`__
which has a larger API, advanced rate limiting, and other features so we may
be considerate of the MediaWiki infrastructure. Pywikibot has also other extra
features such as support for Wikibase (that runs Wikidata).


Installation
------------------

Pip Installation:

::

    $ pip install pymediawiki

To install from source:

To install ``mediawiki``, simply clone the `repository on GitHub
<https://github.com/barrust/mediawiki>`__, then run from the folder:

::

    $ python setup.py install

``mediawiki`` supports python versions 3.5 - 3.9

For *python 2.7* support, install `release 0.6.7 <https://github.com/barrust/mediawiki/releases/tag/v0.6.7>`__

::

    $ pip install pymediawiki==0.6.7

Documentation
-------------

Documentation of the latest release is hosted on
`readthedocs.io <http://pymediawiki.readthedocs.io/en/latest/?>`__

To build the documentation yourself run:

::

    $ pip install sphinx
    $ cd docs/
    $ make html

Automated Tests
------------------

To run automated tests, one must simply run the following command from the
downloaded folder:

::

  $ python setup.py test


Quickstart
------------------

Import mediawiki and run a standard search against Wikipedia:

.. code:: python

    >>> from mediawiki import MediaWiki
    >>> wikipedia = MediaWiki()
    >>> wikipedia.search('washington')

Run more advanced searches:

.. code:: python

    >>> wikipedia.opensearch('washington')
    >>> wikipedia.allpages('a')
    >>> wikipedia.geosearch(title='washington, d.c.')
    >>> wikipedia.geosearch(latitude='0.0', longitude='0.0')
    >>> wikipedia.prefixsearch('arm')
    >>> wikipedia.random(pages=10)

Pull a MediaWiki page and some of the page properties:

.. code:: python

    >>> p = wikipedia.page('Chess')
    >>> p.title
    >>> p.summary
    >>> p.categories
    >>> p.images
    >>> p.links
    >>> p.langlinks

See the `documentation for more examples!
<http://pymediawiki.readthedocs.io/en/latest/quickstart.html#quickstart>`_



Changelog
------------------

Please see the `changelog
<https://github.com/barrust/mediawiki/blob/master/CHANGELOG.md>`__ for a list
of all changes.


License
-------

MIT licensed. See the `LICENSE file
<https://github.com/barrust/Wikipedia/blob/master/LICENSE>`__
for full details.

# MediaWiki Changelog

## Version 0.7.1

* Add `page.wikitext` support for pulling the page contents as [wikitext](https://en.wikipedia.org/wiki/Help:Wikitext)
* Add [proxy support](https://requests.readthedocs.io/en/master/user/advanced/#proxies) by passing info directly to the requests library.

## Version 0.7.0

* Remove support for ***python 2.7***!
* Add files to `categorymembers()` pull [PR #100](https://github.com/barrust/mediawiki/pull/100) Thanks [tbm](https://github.com/tbm)
* Better support calls to limit results to the maximum 500 results per query (per API documentation) [PR #99](https://github.com/barrust/mediawiki/pull/99) Thanks [tbm](https://github.com/tbm)

## Version 0.6.7

* ***NOTE:*** Last planned support for **Python 2.7**
* Cache results of `BeautifulSoup` parsing of `page.html` [PR #90](https://github.com/barrust/mediawiki/pull/90) Thanks [ldorigo](https://github.com/ldorigo)
* Add ability to pull links from the header section; Thanks to [ldorigo](https://github.com/ldorigo) for example code!
* Add ability to pull the header section text
* Move to GitHub Actions and CodeCov for testing

## Version 0.6.6

* Fix a bug using `find_all()` on newer versions of BeautifulSoup4

## Version 0.6.5

* Fix for `suggest` [PR #85](https://github.com/barrust/mediawiki/pull/85) Thanks [rubabredwan](https://github.com/rubabredwan)
* `__slots__` usage

## Version 0.6.4

* Add ability to login during initialization [issue #79](https://github.com/barrust/mediawiki/issues/79)

## Version 0.6.3

* Capture timeout exception
* bs4 does not support `hasattr` but uses `*.has_attr()`

## Version 0.6.2

* Add `allpages` functionality [PR #75](https://github.com/barrust/mediawiki/pull/75)
* Add `langlinks` page property [PR #76](https://github.com/barrust/mediawiki/pull/76)

## Version 0.6.1

* Fix DisambiguationError title property [issue #72](https://github.com/barrust/mediawiki/issues/72)
* Change to using [black](https://github.com/ambv/black) formatting

## Version 0.6.0

* Fix for the table of contents for all subsections [issue #64](https://github.com/barrust/mediawiki/issues/64)
* Combined properties into a single set of pulling to reduce the load on the MediaWiki infrastructure [issue #55](https://github.com/barrust/mediawiki/issues/55)

## Version 0.5.1

* Added Table of Contents parsing based on sections: result is an OrderedDict
* Fix issue where some sections are not pulled correctly

## Version 0.5.0

* Add support for logging into the MediaWiki site [issue #59](https://github.com/barrust/mediawiki/issues/59)

## Version 0.4.1

* Default to `https`
* Add `category_prefix` property to properly support categories in non-English
MediaWiki sites [issue #48](https://github.com/barrust/mediawiki/issues/48)
* Add `user_agent` as an initialization parameter and added information to the
documentation about why one should set the user-agent string [issue #50](https://github.com/barrust/mediawiki/issues/50)

### Version 0.4.0

* Add fix to use the `query-continue` parameter to continue to pull category
members [issue #39](https://github.com/barrust/mediawiki/issues/39)
* Better handle large categorymember selections
* Add better handling of exception attributes including adding them to the
documentation
* Correct the pulling of the section titles without additional markup [issue #42](https://github.com/barrust/mediawiki/issues/42)
* Handle memoization of unicode parameters in python 2.7
* ***Change default timeout*** for HTTP requests to 15 seconds

### Version 0.3.16

* Add ability to turn off caching completely
* Fix bug when disambiguation link does not have a title [issue #35](https://github.com/barrust/mediawiki/issues/35)

### Version 0.3.15

* Add parse all links within a section [issue #33](https://github.com/barrust/mediawiki/issues/33)
* Add base url property to mediawiki site

### Version 0.3.14

* Add refresh interval to cached responses (Defaults to not refresh)
[issue #30](https://github.com/barrust/mediawiki/issues/30)
* Fix minor documentation issues

### Version 0.3.13

* Add pulling hatnotes [issue #6](https://github.com/barrust/mediawiki/issues/6)
* Add pulling list of main images or logos [issue #28](https://github.com/barrust/mediawiki/issues/28)

### Version 0.3.12

* Default API URL is now language specific: [PR #26](https://github.com/barrust/mediawiki/pull/26)

### Version 0.3.11

* Re-factor MediaWikiPage into its own file
* Remove setting properties outside of __init__()
* Better Unicode support
* Add CONTRIBUTING.md file

### Version 0.3.10

* Add categorytree support
* Remove adding 'http:' to references if missing

### Version 0.3.9

* Fix infinite loop on continued queries: [issue #15](https://github.com/barrust/mediawiki/issues/15)
 * Check by looking at the continue variable over time; if it is the same, exit
* Fix image with no url: [issue #14](https://github.com/barrust/mediawiki/issues/14)

### Version 0.3.8

* Fix empty disambiguation list items


### Version 0.3.7

* Memoize support default parameters
* Add support test for Python 3.6


### Version 0.3.6

* Updated Exception documentation
* Fix badges in Readme file
* Additional test coverage


### Version 0.3.5

* Add documentation to README
  * Quickstart information
  * pip install instructions [pypi - pymediawiki](https://pypi.python.org/pypi/pymediawiki/)
  * Additional testing


### Version 0.3.4

* Update documentation
* Better continuous integration
* Better test data: [issue #4](https://github.com/barrust/mediawiki/issues/4)
* First version on PyPi: [issue #8](https://github.com/barrust/mediawiki/issues/8)

### Version 0.3.3

* Improve testing strategy
 * Move tests to json from pickle
* Improve parameter checking for geosearch
* Code standardization
 * Pep8
 * Pylint
 * Single quote strings


### Version 0.3.2

* OpenSearch functionality
* PrefixSearch functionality


### Version 0.3.1

* Page Summary
* Page Sections
* Enforce sorting of page properties


### Pre-Version 0.3.1

* Add MediaWiki class
* Add MediaWikiPage class
* Stubbed out functionality
* Add page properties


