Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.

Download
ActivePython
INSTALL>
pypm install wikipedia

How to install wikipedia

  1. Download and install ActivePython
  2. Open Command Prompt
  3. Type pypm install wikipedia
 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
Windows (64-bit)
Mac OS X (10.5+)
Linux (32-bit)
Linux (64-bit)
1.0.0 Available View build log
 
License
MIT
Imports
Lastest release
version 1.0.0 on Jan 9th, 2014
https://travis-ci.org/goldsmith/Wikipedia.png?branch=master https://pypip.in/d/wikipedia/badge.png https://pypip.in/v/wikipedia/badge.png

Wikipedia is a Python library that makes it easy to access and parse data from Wikipedia.

Search Wikipedia, get article summaries, get data like links and images from a page, and more. Wikipedia wraps the MediaWiki API so you can focus on using Wikipedia data, not getting it.

System Message: ERROR/3 (<string>, line 19)

Unknown directive type "code".

.. code:: python

    >>> import wikipedia
    >>> print wikipedia.summary("Wikipedia")
    # Wikipedia (/wkpidi/ or /wkipidi/ WIK-i-PEE-dee-) is a collaboratively edited, multilingual, free Internet encyclopedia supported by the non-profit Wikimedia Foundation...

    >>> wikipedia.search("Barack")
    # [u'Barak (given name)', u'Barack Obama', u'Barack (brandy)', u'Presidency of Barack Obama', u'Family of Barack Obama', u'First inauguration of Barack Obama', u'Barack Obama presidential campaign, 2008', u'Barack Obama, Sr.', u'Barack Obama citizenship conspiracy theories', u'Presidential transition of Barack Obama']

    >>> ny = wikipedia.page("New York")
    >>> ny.title
    # u'New York'
    >>> ny.url
    # u'http://en.wikipedia.org/wiki/New_York'
    >>> ny.content
    # u'New York is a state in the Northeastern region of the United States. New York is the 27th-most exten'...
    >>> ny.links[0]
    # u'1790 United States Census'

    >>> wikipedia.set_lang("fr")
    >>> wikipedia.summary("Facebook", sentences=1)
    # Facebook est un service de rseautage social en ligne sur Internet permettant d'y publier des informations (photographies, liens, textes, etc.) en contrlant leur visibilit par diffrentes catgories de personnes.

Note: this library was designed for ease of use and simplicity, not for advanced use. If you plan on doing serious scraping or automated requests, please use Pywikipediabot (or one of the other more advanced Python MediaWiki API wrappers), which has a larger API, rate limiting, and other features so we can be considerate of the MediaWiki infrastructure.

Installation

To install Wikipedia, simply run:

$ pip install wikipedia

Wikipedia is compatible with Python 2.6+ (2.7+ to run unittest discover) and Python 3.3+.

Documentation

Read the docs at https://wikipedia.readthedocs.org/en/latest/.

To run tests, clone the respository on GitHub, then run:

$ pip install -r requirements.txt
$ python -m unittest discover tests/ '*test.py'

in the root project directory.

To build the documentation yourself, after installing requirements.txt, run:

$ pip install sphinx
$ cd docs/
$ make html

License

MIT licensed. See the LICENSE file for full details.

Credits

  • wiki-api by @richardasaurus for inspiration
  • @nmoroze and @themichaelyang for feedback and suggestions
  • The Wikimedia Foundation for giving the world free access to data

Subscribe to package updates

Last updated Jan 9th, 2014

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.