wikipedia


Namewikipedia JSON
Version 1.4.0 PyPI version JSON
download
home_pagehttps://github.com/goldsmith/Wikipedia
SummaryWikipedia API for Python
upload_time2014-11-15 15:59:49
maintainerNone
docs_urlNone
authorJonathan Goldsmith
requires_pythonNone
licenseMIT
keywords python wikipedia api
VCS
bugtrack_url
requirements beautifulsoup4 requests
Travis-CI
coveralls test coverage No coveralls.
            Wikipedia
=========

.. image:: https://travis-ci.org/goldsmith/Wikipedia.png?branch=master
  :target: https://travis-ci.org/goldsmith/Wikipedia
.. image:: https://pypip.in/d/wikipedia/badge.png
  :target: https://crate.io/packages/wikipedia
.. image:: https://pypip.in/v/wikipedia/badge.png
  :target: https://crate.io/packages/wikipedia
.. image:: https://pypip.in/license/wikipedia/badge.png
    :target: https://pypi.python.org/pypi/wikipedia/
    :alt: License

**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 <https://www.mediawiki.org/wiki/API>`__ so you can focus on using
Wikipedia data, not getting it.

.. code:: python

  >>> import wikipedia
  >>> print wikipedia.summary("Wikipedia")
  # Wikipedia (/ˌwɪkɨˈpiːdiə/ or /ˌwɪkiˈpiːdiə/ 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 réseautage social en ligne sur Internet permettant d'y publier des informations (photographies, liens, textes, etc.) en contrôlant leur visibilité par différentes catégories 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 <http://www.mediawiki.org/wiki/Manual:Pywikipediabot>`__ (or one of the other more advanced `Python MediaWiki API wrappers <http://en.wikipedia.org/wiki/Wikipedia:Creating_a_bot#Python>`__), 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/.

-  `Quickstart <https://wikipedia.readthedocs.org/en/latest/quickstart.html>`__
-  `Full API <https://wikipedia.readthedocs.org/en/latest/code.html>`__

To run tests, clone the `respository on GitHub <https://github.com/goldsmith/Wikipedia>`__, then run:

::

  $ pip install -r requirements.txt
  $ bash runtests  # will run tests for python and python3
  $ python -m unittest discover tests/ '*test.py'  # manual style

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 <https://github.com/goldsmith/Wikipedia/blob/master/LICENSE>`__ for
full details.

Credits
-------

-  `wiki-api <https://github.com/richardasaurus/wiki-api>`__ by
   @richardasaurus for inspiration
-  @nmoroze and @themichaelyang for feedback and suggestions
-  The `Wikimedia
   Foundation <http://wikimediafoundation.org/wiki/Home>`__ for giving
   the world free access to data



.. image:: https://d2weczhvl823v0.cloudfront.net/goldsmith/wikipedia/trend.png
   :alt: Bitdeli badge
   :target: https://bitdeli.com/free
            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/goldsmith/Wikipedia",
    "name": "wikipedia",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python wikipedia API",
    "author": "Jonathan Goldsmith",
    "author_email": "jhghank@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/67/35/25e68fbc99e672127cc6fbb14b8ec1ba3dfef035bf1e4c90f78f24a80b7d/wikipedia-1.4.0.tar.gz",
    "platform": "UNKNOWN",
    "description": "Wikipedia\n=========\n\n.. image:: https://travis-ci.org/goldsmith/Wikipedia.png?branch=master\n  :target: https://travis-ci.org/goldsmith/Wikipedia\n.. image:: https://pypip.in/d/wikipedia/badge.png\n  :target: https://crate.io/packages/wikipedia\n.. image:: https://pypip.in/v/wikipedia/badge.png\n  :target: https://crate.io/packages/wikipedia\n.. image:: https://pypip.in/license/wikipedia/badge.png\n    :target: https://pypi.python.org/pypi/wikipedia/\n    :alt: License\n\n**Wikipedia** is a Python library that makes it easy to access and parse\ndata from Wikipedia.\n\nSearch Wikipedia, get article summaries, get data like links and images\nfrom a page, and more. Wikipedia wraps the `MediaWiki\nAPI <https://www.mediawiki.org/wiki/API>`__ so you can focus on using\nWikipedia data, not getting it.\n\n.. code:: python\n\n  >>> import wikipedia\n  >>> print wikipedia.summary(\"Wikipedia\")\n  # Wikipedia (/\u02ccw\u026ak\u0268\u02c8pi\u02d0di\u0259/ or /\u02ccw\u026aki\u02c8pi\u02d0di\u0259/ WIK-i-PEE-dee-\u0259) is a collaboratively edited, multilingual, free Internet encyclopedia supported by the non-profit Wikimedia Foundation...\n\n  >>> wikipedia.search(\"Barack\")\n  # [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']\n\n  >>> ny = wikipedia.page(\"New York\")\n  >>> ny.title\n  # u'New York'\n  >>> ny.url\n  # u'http://en.wikipedia.org/wiki/New_York'\n  >>> ny.content\n  # u'New York is a state in the Northeastern region of the United States. New York is the 27th-most exten'...\n  >>> ny.links[0]\n  # u'1790 United States Census'\n\n  >>> wikipedia.set_lang(\"fr\")\n  >>> wikipedia.summary(\"Facebook\", sentences=1)\n  # Facebook est un service de r\u00e9seautage social en ligne sur Internet permettant d'y publier des informations (photographies, liens, textes, etc.) en contr\u00f4lant leur visibilit\u00e9 par diff\u00e9rentes cat\u00e9gories de personnes.\n\nNote: 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 <http://www.mediawiki.org/wiki/Manual:Pywikipediabot>`__ (or one of the other more advanced `Python MediaWiki API wrappers <http://en.wikipedia.org/wiki/Wikipedia:Creating_a_bot#Python>`__), which has a larger API, rate limiting, and other features so we can be considerate of the MediaWiki infrastructure.\n\nInstallation\n------------\n\nTo install Wikipedia, simply run:\n\n::\n\n  $ pip install wikipedia\n\nWikipedia is compatible with Python 2.6+ (2.7+ to run unittest discover) and Python 3.3+.\n\nDocumentation\n-------------\n\nRead the docs at https://wikipedia.readthedocs.org/en/latest/.\n\n-  `Quickstart <https://wikipedia.readthedocs.org/en/latest/quickstart.html>`__\n-  `Full API <https://wikipedia.readthedocs.org/en/latest/code.html>`__\n\nTo run tests, clone the `respository on GitHub <https://github.com/goldsmith/Wikipedia>`__, then run:\n\n::\n\n  $ pip install -r requirements.txt\n  $ bash runtests  # will run tests for python and python3\n  $ python -m unittest discover tests/ '*test.py'  # manual style\n\nin the root project directory.\n\nTo build the documentation yourself, after installing requirements.txt, run:\n\n::\n\n  $ pip install sphinx\n  $ cd docs/\n  $ make html\n\nLicense\n-------\n\nMIT licensed. See the `LICENSE\nfile <https://github.com/goldsmith/Wikipedia/blob/master/LICENSE>`__ for\nfull details.\n\nCredits\n-------\n\n-  `wiki-api <https://github.com/richardasaurus/wiki-api>`__ by\n   @richardasaurus for inspiration\n-  @nmoroze and @themichaelyang for feedback and suggestions\n-  The `Wikimedia\n   Foundation <http://wikimediafoundation.org/wiki/Home>`__ for giving\n   the world free access to data\n\n\n\n.. image:: https://d2weczhvl823v0.cloudfront.net/goldsmith/wikipedia/trend.png\n   :alt: Bitdeli badge\n   :target: https://bitdeli.com/free",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Wikipedia API for Python",
    "version": "1.4.0",
    "split_keywords": [
        "python",
        "wikipedia",
        "api"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "898944eb28062d898d3d0d948fdd3fec",
                "sha256": "db0fad1829fdd441b1852306e9856398204dc0786d2996dd2e0c8bb8e26133b2"
            },
            "downloads": -1,
            "filename": "wikipedia-1.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "898944eb28062d898d3d0d948fdd3fec",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 27748,
            "upload_time": "2014-11-15T15:59:49",
            "upload_time_iso_8601": "2014-11-15T15:59:49.808169Z",
            "url": "https://files.pythonhosted.org/packages/67/35/25e68fbc99e672127cc6fbb14b8ec1ba3dfef035bf1e4c90f78f24a80b7d/wikipedia-1.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2014-11-15 15:59:49",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "goldsmith",
    "github_project": "Wikipedia",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "beautifulsoup4",
            "specs": []
        },
        {
            "name": "requests",
            "specs": [
                [
                    "<",
                    "3.0.0"
                ],
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        }
    ],
    "lcname": "wikipedia"
}
        
Elapsed time: 0.02042s