Wikipedia-API


NameWikipedia-API JSON
Version 0.6.0 PyPI version JSON
download
home_pagehttps://github.com/martin-majlis/Wikipedia-API
SummaryPython Wrapper for Wikipedia
upload_time2023-06-29 21:53:42
maintainer
docs_urlNone
authorMartin Majlis
requires_python
licenseMIT
keywords wikipedia api wrapper
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            Wikipedia API
=============

``Wikipedia-API`` is easy to use Python wrapper for `Wikipedias'`_ API. It supports extracting texts, sections, links, categories, translations, etc from Wikipedia. Documentation provides code snippets for the most common use cases.

.. _Wikipedias': https://www.mediawiki.org/wiki/API:Main_page

|build-status| |docs| |cc-coverage| |version| |pyversions| |github-stars-flat|

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

This package requires at least Python 3.4 to install because it's using IntEnum.

.. code-block:: python

    pip3 install wikipedia-api


Usage
-----

Goal of ``Wikipedia-API`` is to provide simple and easy to use API for retrieving informations from Wikipedia. Bellow are examples of common use cases.

Importing
~~~~~~~~~

.. code-block:: python

	import wikipediaapi

How To Get Single Page
~~~~~~~~~~~~~~~~~~~~~~

Getting single page is straightforward. You have to initialize ``Wikipedia`` object and ask for page by its name.
To initialize it, you have to provide:

* `user_agent` to identify your project. Please follow the recommended `format`_.
* `language` to specify language mutation. It has to be one of `supported languages`_.

.. _format: https://meta.wikimedia.org/wiki/User-Agent_policy
.. _supported languages: http://meta.wikimedia.org/wiki/List_of_Wikipedias

.. code-block:: python

    import wikipediaapi
	wiki_wiki = wikipediaapi.Wikipedia('MyProjectName (merlin@example.com)', 'en')

	page_py = wiki_wiki.page('Python_(programming_language)')


How To Check If Wiki Page Exists
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For checking, whether page exists, you can use function ``exists``.

.. code-block:: python

	page_py = wiki_wiki.page('Python_(programming_language)')
	print("Page - Exists: %s" % page_py.exists())
	# Page - Exists: True

	page_missing = wiki_wiki.page('NonExistingPageWithStrangeName')
	print("Page - Exists: %s" % 	page_missing.exists())
	# Page - Exists: False

How To Get Page Summary
~~~~~~~~~~~~~~~~~~~~~~~

Class ``WikipediaPage`` has property ``summary``, which returns description of Wiki page.

.. code-block:: python


    import wikipediaapi
	wiki_wiki = wikipediaapi.Wikipedia('MyProjectName (merlin@example.com)', 'en')

	print("Page - Title: %s" % page_py.title)
	# Page - Title: Python (programming language)

	print("Page - Summary: %s" % page_py.summary[0:60])
	# Page - Summary: Python is a widely used high-level programming language for


How To Get Page URL
~~~~~~~~~~~~~~~~~~~

``WikipediaPage`` has two properties with URL of the page. It is ``fullurl`` and ``canonicalurl``.

.. code-block:: python

	print(page_py.fullurl)
	# https://en.wikipedia.org/wiki/Python_(programming_language)

	print(page_py.canonicalurl)
	# https://en.wikipedia.org/wiki/Python_(programming_language)

How To Get Full Text
~~~~~~~~~~~~~~~~~~~~

To get full text of Wikipedia page you should use property ``text`` which constructs text of the page
as concatanation of summary and sections with their titles and texts.

.. code-block:: python

	wiki_wiki = wikipediaapi.Wikipedia(
	    user_agent='MyProjectName (merlin@example.com)',
		language='en',
		extract_format=wikipediaapi.ExtractFormat.WIKI
	)

	p_wiki = wiki_wiki.page("Test 1")
	print(p_wiki.text)
	# Summary
	# Section 1
	# Text of section 1
	# Section 1.1
	# Text of section 1.1
	# ...


	wiki_html = wikipediaapi.Wikipedia(
	    user_agent='MyProjectName (merlin@example.com)',
		language='en',
		extract_format=wikipediaapi.ExtractFormat.HTML
	)
	p_html = wiki_html.page("Test 1")
	print(p_html.text)
	# <p>Summary</p>
	# <h2>Section 1</h2>
	# <p>Text of section 1</p>
	# <h3>Section 1.1</h3>
	# <p>Text of section 1.1</p>
	# ...

How To Get Page Sections
~~~~~~~~~~~~~~~~~~~~~~~~

To get all top level sections of page, you have to use property ``sections``. It returns list of
``WikipediaPageSection``, so you have to use recursion to get all subsections.

.. code-block:: python

	def print_sections(sections, level=0):
		for s in sections:
			print("%s: %s - %s" % ("*" * (level + 1), s.title, s.text[0:40]))
			print_sections(s.sections, level + 1)


	print_sections(page_py.sections)
	# *: History - Python was conceived in the late 1980s,
	# *: Features and philosophy - Python is a multi-paradigm programming l
	# *: Syntax and semantics - Python is meant to be an easily readable
	# **: Indentation - Python uses whitespace indentation, rath
	# **: Statements and control flow - Python's statements include (among other
	# **: Expressions - Some Python expressions are similar to l

How To Get Page Section By Title
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To get last section of page with given title, you have to use function ``section_by_title``.
It returns the last ``WikipediaPageSection`` with this title.

.. code-block:: python

	section_history = page_py.section_by_title('History')
	print("%s - %s" % (section_history.title, section_history.text[0:40]))

	# History - Python was conceived in the late 1980s b

How To Get All Page Sections By Title
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To get all sections of page with given title, you have to use function ``sections_by_title``.
It returns the all ``WikipediaPageSection`` with this title.

.. code-block:: python

	page_1920 = wiki_wiki.page('1920')
	sections_january = page_1920.sections_by_title('January')
	for s in sections_january:
	    print("* %s - %s" % (s.title, s.text[0:40]))

    # * January - January 1
    # Polish–Soviet War in 1920: The
    # * January - January 2
    # Isaac Asimov, American author
    # * January - January 1 – Zygmunt Gorazdowski, Polish

How To Get Page In Other Languages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you want to get other translations of given page, you should use property ``langlinks``. It is map,
where key is language code and value is ``WikipediaPage``.

.. code-block:: python

	def print_langlinks(page):
		langlinks = page.langlinks
		for k in sorted(langlinks.keys()):
		    v = langlinks[k]
		    print("%s: %s - %s: %s" % (k, v.language, v.title, v.fullurl))

	print_langlinks(page_py)
	# af: af - Python (programmeertaal): https://af.wikipedia.org/wiki/Python_(programmeertaal)
	# als: als - Python (Programmiersprache): https://als.wikipedia.org/wiki/Python_(Programmiersprache)
	# an: an - Python: https://an.wikipedia.org/wiki/Python
	# ar: ar - بايثون: https://ar.wikipedia.org/wiki/%D8%A8%D8%A7%D9%8A%D8%AB%D9%88%D9%86
	# as: as - পাইথন: https://as.wikipedia.org/wiki/%E0%A6%AA%E0%A6%BE%E0%A6%87%E0%A6%A5%E0%A6%A8

	page_py_cs = page_py.langlinks['cs']
	print("Page - Summary: %s" % page_py_cs.summary[0:60])
	# Page - Summary: Python (anglická výslovnost [ˈpaiθtən]) je vysokoúrovňový sk

How To Get Links To Other Pages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you want to get all links to other wiki pages from given page, you need to use property ``links``.
It's map, where key is page title and value is ``WikipediaPage``.

.. code-block:: python

	def print_links(page):
		links = page.links
		for title in sorted(links.keys()):
		    print("%s: %s" % (title, links[title]))

	print_links(page_py)
	# 3ds Max: 3ds Max (id: ??, ns: 0)
	# ?:: ?: (id: ??, ns: 0)
	# ABC (programming language): ABC (programming language) (id: ??, ns: 0)
	# ALGOL 68: ALGOL 68 (id: ??, ns: 0)
	# Abaqus: Abaqus (id: ??, ns: 0)
	# ...

How To Get Page Categories
~~~~~~~~~~~~~~~~~~~~~~~~~~

If you want to get all categories under which page belongs, you should use property ``categories``.
It's map, where key is category title and value is ``WikipediaPage``.

.. code-block:: python

	def print_categories(page):
		categories = page.categories
		for title in sorted(categories.keys()):
		    print("%s: %s" % (title, categories[title]))


	print("Categories")
	print_categories(page_py)
	# Category:All articles containing potentially dated statements: ...
	# Category:All articles with unsourced statements: ...
	# Category:Articles containing potentially dated statements from August 2016: ...
	# Category:Articles containing potentially dated statements from March 2017: ...
	# Category:Articles containing potentially dated statements from September 2017: ...

How To Get All Pages From Category
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

To get all pages from given category, you should use property ``categorymembers``. It returns all members of given category.
You have to implement recursion and deduplication by yourself.

.. code-block:: python

	def print_categorymembers(categorymembers, level=0, max_level=1):
		for c in categorymembers.values():
		    print("%s: %s (ns: %d)" % ("*" * (level + 1), c.title, c.ns))
		    if c.ns == wikipediaapi.Namespace.CATEGORY and level < max_level:
		        print_categorymembers(c.categorymembers, level=level + 1, max_level=max_level)


	cat = wiki_wiki.page("Category:Physics")
	print("Category members: Category:Physics")
	print_categorymembers(cat.categorymembers)

	# Category members: Category:Physics
	# * Statistical mechanics (ns: 0)
	# * Category:Physical quantities (ns: 14)
	# ** Refractive index (ns: 0)
	# ** Vapor quality (ns: 0)
	# ** Electric susceptibility (ns: 0)
	# ** Specific weight (ns: 0)
	# ** Category:Viscosity (ns: 14)
	# *** Brookfield Engineering (ns: 0)

How To See Underlying API Call
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you have problems with retrieving data you can get URL of undrerlying API call.
This will help you determine if the problem is in the library or somewhere else.

.. code-block:: python

    import wikipediaapi
    import sys
    wikipediaapi.log.setLevel(level=wikipediaapi.logging.DEBUG)

    # Set handler if you use Python in interactive mode
    out_hdlr = wikipediaapi.logging.StreamHandler(sys.stderr)
    out_hdlr.setFormatter(wikipediaapi.logging.Formatter('%(asctime)s %(message)s'))
    out_hdlr.setLevel(wikipediaapi.logging.DEBUG)
    wikipediaapi.log.addHandler(out_hdlr)

    wiki = wikipediaapi.Wikipedia(user_agent='MyProjectName (merlin@example.com)', language='en')

    page_ostrava = wiki.page('Ostrava')
    print(page_ostrava.summary)
    # logger prints out: Request URL: http://en.wikipedia.org/w/api.php?action=query&prop=extracts&titles=Ostrava&explaintext=1&exsectionformat=wiki

External Links
--------------

* `GitHub`_
* `PyPi`_
* `Travis`_
* `ReadTheDocs`_

.. _GitHub: https://github.com/martin-majlis/Wikipedia-API/
.. _PyPi: https://pypi.python.org/pypi/Wikipedia-API/
.. _Travis: https://travis-ci.org/martin-majlis/Wikipedia-API/
.. _ReadTheDocs: http://wikipedia-api.readthedocs.io/

Other Badges
------------

|cc-badge| |cc-issues| |coveralls| |version| |pyversions| |implementations|
|github-downloads| |github-tag| |github-release|
|github-commits-since-latest| |github-forks| |github-stars| |github-watches|
|github-commit-activity| |github-last-commit| |github-code-size| |github-repo-size|
|pypi-license| |pypi-wheel| |pypi-format| |pypi-pyversions| |pypi-implementations|
|pypi-status| |pypi-downloads-dd| |pypi-downloads-dw| |pypi-downloads-dm|
|libraries-io-sourcerank| |libraries-io-dependent-repos|


Other Pages
-----------




.. |build-status| image:: https://travis-ci.org/martin-majlis/Wikipedia-API.svg?branch=master
    :alt: build status
    :target: https://travis-ci.org/martin-majlis/Wikipedia-API

.. |docs| image:: https://readthedocs.org/projects/wikipedia-api/badge/?version=latest
    :target: http://wikipedia-api.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. |cc-badge| image:: https://codeclimate.com/github/martin-majlis/Wikipedia-API/badges/gpa.svg
    :target: https://codeclimate.com/github/martin-majlis/Wikipedia-API
    :alt: Code Climate

.. |cc-issues| image:: https://codeclimate.com/github/martin-majlis/Wikipedia-API/badges/issue_count.svg
    :target: https://codeclimate.com/github/martin-majlis/Wikipedia-API
    :alt: Issue Count

.. |cc-coverage| image:: https://api.codeclimate.com/v1/badges/6e2c24d72438b39e5c26/test_coverage
    :target: https://codeclimate.com/github/martin-majlis/Wikipedia-API
    :alt: Test Coverage

.. |coveralls| image:: https://coveralls.io/repos/github/martin-majlis/Wikipedia-API/badge.svg?branch=master
	:target: https://coveralls.io/github/martin-majlis/Wikipedia-API?branch=master
	:alt: Coveralls

.. |version| image:: https://img.shields.io/pypi/v/wikipedia-api.svg?style=flat
	:target: https://pypi.python.org/pypi/Wikipedia-API
	:alt: Version

.. |pyversions| image:: https://img.shields.io/pypi/pyversions/wikipedia-api.svg?style=flat
	:target: https://pypi.python.org/pypi/Wikipedia-API
	:alt: Py Versions

.. |implementations| image:: https://img.shields.io/pypi/implementation/wikipedia-api.svg?style=flat
    :target: https://pypi.python.org/pypi/Wikipedia-API
	:alt: Implementations

.. |github-downloads| image:: https://img.shields.io/github/downloads/martin-majlis/Wikipedia-API/total.svg
	:target: https://github.com/martin-majlis/Wikipedia-API/releases
	:alt: Downloads

.. |github-tag| image:: https://img.shields.io/github/tag/martin-majlis/Wikipedia-API.svg
	:target: https://github.com/martin-majlis/Wikipedia-API/tags
	:alt: Tags

.. |github-release| image:: https://img.shields.io/github/release/martin-majlis/Wikipedia-API.svg
	:target: https://github.com/martin-majlis/Wikipedia-API/

.. |github-commits-since-latest| image:: https://img.shields.io/github/commits-since/martin-majlis/Wikipedia-API/latest.svg
	:target: https://github.com/martin-majlis/Wikipedia-API/
	:alt: Github commits (since latest release)

.. |github-forks| image:: https://img.shields.io/github/forks/martin-majlis/Wikipedia-API.svg?style=social&label=Fork
	:target: https://github.com/martin-majlis/Wikipedia-API/
	:alt: GitHub forks

.. |github-stars| image:: https://img.shields.io/github/stars/martin-majlis/Wikipedia-API.svg?style=social&label=Stars
	:target: https://github.com/martin-majlis/Wikipedia-API/
	:alt: GitHub stars

.. |github-stars-flat| image:: https://img.shields.io/github/stars/martin-majlis/Wikipedia-API.svg?style=flat&label=Stars
	:target: https://github.com/martin-majlis/Wikipedia-API/
	:alt: GitHub stars

.. |github-watches| image:: https://img.shields.io/github/watchers/martin-majlis/Wikipedia-API.svg?style=social&label=Watch
	:target: https://github.com/martin-majlis/Wikipedia-API/
	:alt: GitHub watchers

.. |github-commit-activity| image:: https://img.shields.io/github/commit-activity/y/martin-majlis/Wikipedia-API.svg
	:target: https://github.com/martin-majlis/Wikipedia-API/commits/master
	:alt: GitHub commit activity the past week, 4 weeks, year

.. |github-last-commit| image:: https://img.shields.io/github/commits/martin-majlis/Wikipedia-API/last.svg
	:target: https://github.com/martin-majlis/Wikipedia-API/
	:alt: Last commit

.. |github-code-size| image:: https://img.shields.io/github/languages/code-size/martin-majlis/Wikipedia-API.svg
	:target: https://github.com/martin-majlis/Wikipedia-API/
	:alt: GitHub code size in bytes

.. |github-repo-size| image:: https://img.shields.io/github/repo-size/martin-majlis/Wikipedia-API.svg
	:target: https://github.com/martin-majlis/Wikipedia-API/
	:alt: GitHub repo size in bytes

.. |pypi-license| image:: https://img.shields.io/pypi/l/Wikipedia-API.svg
	:target: https://pypi.python.org/pypi/Wikipedia-API/
	:alt: PyPi License

.. |pypi-wheel| image:: https://img.shields.io/pypi/wheel/Wikipedia-API.svg
	:target: https://pypi.python.org/pypi/Wikipedia-API/
	:alt: PyPi Wheel

.. |pypi-format| image:: https://img.shields.io/pypi/format/Wikipedia-API.svg
	:target: https://pypi.python.org/pypi/Wikipedia-API/
	:alt: PyPi Format

.. |pypi-pyversions| image:: https://img.shields.io/pypi/pyversions/Wikipedia-API.svg
	:target: https://pypi.python.org/pypi/Wikipedia-API/
	:alt: PyPi PyVersions

.. |pypi-implementations| image:: https://img.shields.io/pypi/implementation/Wikipedia-API.svg
	:target: https://pypi.python.org/pypi/Wikipedia-API/
	:alt: PyPi Implementations

.. |pypi-status| image:: https://img.shields.io/pypi/status/Wikipedia-API.svg
	:target: https://pypi.python.org/pypi/Wikipedia-API/
	:alt: PyPi Status

.. |pypi-downloads-dd| image:: https://img.shields.io/pypi/dd/Wikipedia-API.svg
	:target: https://pypi.python.org/pypi/Wikipedia-API/
	:alt: PyPi Downloads - Day

.. |pypi-downloads-dw| image:: https://img.shields.io/pypi/dw/Wikipedia-API.svg
	:target: https://pypi.python.org/pypi/Wikipedia-API/
	:alt: PyPi Downloads - Week

.. |pypi-downloads-dm| image:: https://img.shields.io/pypi/dm/Wikipedia-API.svg
	:target: https://pypi.python.org/pypi/Wikipedia-API/
	:alt: PyPi Downloads - Month

.. |libraries-io-sourcerank| image:: https://img.shields.io/librariesio/sourcerank/pypi/Wikipedia-API.svg
	:target: https://libraries.io/pypi/Wikipedia-API
	:alt: Libraries.io - SourceRank

.. |libraries-io-dependent-repos| image:: https://img.shields.io/librariesio/dependent-repos/pypi/Wikipedia-API.svg
	:target: https://libraries.io/pypi/Wikipedia-API
	:alt: Libraries.io - Dependent Repos


Changelog
=========

0.5.8
-----

* Adds support for retrieving all sections with given name - `Issue 39`_

.. _Issue 39: https://github.com/martin-majlis/Wikipedia-API/issues/39

0.5.4
-----

* Namespace could be arbitrary integer - `Issue 29`_

.. _Issue 29: https://github.com/martin-majlis/Wikipedia-API/issues/29


0.5.3
-----

* Adds persistent HTTP connection - `Issue 26`_
    * Downloading 50 pages reduced from 13s to 8s => 40% speed up

.. _Issue 26: https://github.com/martin-majlis/Wikipedia-API/issues/26


0.5.2
-----

* Adds namespaces 102 - 105 - `Issue 24`_

.. _Issue 24: https://github.com/martin-majlis/Wikipedia-API/issues/24

0.5.1
-----

* Adds tox for testing different Python versions

0.5.0
-----

* Allows modifying API call parameters
* Fixes `Issue 16`_ - hidden categories
* Fixes `Issue 21`_ - summary extraction

.. _Issue 16: https://github.com/martin-majlis/Wikipedia-API/issues/16
.. _Issue 21: https://github.com/martin-majlis/Wikipedia-API/issues/21


0.4.5
-----

* Handles missing sections correctly
* Fixes `Issue 20`_

.. _Issue 20: https://github.com/martin-majlis/Wikipedia-API/issues/20


0.4.4
-----
* Uses HTTPS directly instead of HTTP to avoid redirect

0.4.3
-----
* Correctly extracts text from pages without sections
* Adds support for quoted page titles

.. code:: python

    api = wikipediaapi.Wikipedia(
        language='hi',
    )
    python = api.article(
        title='%E0%A4%AA%E0%A4%BE%E0%A4%87%E0%A4%A5%E0%A4%A8',
        unquote=True,
    )
    print(python.summary)

0.4.2
-----
* Adds support for Python 3.4 by not using f-strings

0.4.1
-----
* Uses code style enforced by flake8
* Increased code coverage

0.4.0
-----
* Uses type annotations => minimal requirement is now Python 3.5
* Adds possibility to use more parameters for `request`_. For example:

.. code:: python

    api = wikipediaapi.Wikipedia(
        language='en',
        proxies={'http': 'http://localhost:1234'}
    )

* Extends documentation

.. _request: http://docs.python-requests.org/en/master/api/#requests.request

0.3.4
-----
* Adds support for `property Categorymembers`_
* Adds property ``text`` for retrieving complete text of the page

.. _property Categorymembers: https://www.mediawiki.org/wiki/API:Categorymembers

0.3.3
-----
* Added support for `request timeout`_
* Add header: Accept-Encoding: gzip

.. _request timeout: https://github.com/martin-majlis/Wikipedia-API/issues/1

0.3.2
-----
* Added support for `property Categories`_

.. _property Categories: https://www.mediawiki.org/wiki/API:Categories

0.3.1
-----
* Removing ``WikipediaLangLink``
* Page keeps track of its own language, so it's easier to jump between different translations of the same page

0.3.0
-----
* Rename directory from ``wikipedia`` to ``wikipediaapi`` to avoid collisions

0.2.4
-----
* Handle redirects properly

0.2.3
-----
* Usage method ``page`` instead of ``article`` in ``Wikipedia``

0.2.2
-----
* Added support for `property Links`_

.. _property Links: https://www.mediawiki.org/wiki/API:Links

0.2.1
-----
* Added support for `property Langlinks`_

.. _property Langlinks: https://www.mediawiki.org/wiki/API:Langlinks

0.2.0
-----
* Use properties instead of functions
* Added support for `property Info`_

.. _property Info: https://www.mediawiki.org/wiki/API:Info

0.1.6
-----
* Support for extracting texts with HTML markdown
* Added initial version of unit tests

0.1.4
-----
* It's possible to extract summary and sections of the page
* Added support for `property Extracts`_

.. _property Extracts: https://www.mediawiki.org/wiki/Extension:TextExtracts#API

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/martin-majlis/Wikipedia-API",
    "name": "Wikipedia-API",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "Wikipedia API wrapper",
    "author": "Martin Majlis",
    "author_email": "martin@majlis.cz",
    "download_url": "https://files.pythonhosted.org/packages/0b/a5/ae546250aaec1c6b5b4bab7cc97f07a47587f09c942f086d614ecdeeb422/Wikipedia-API-0.6.0.tar.gz",
    "platform": "any",
    "description": "Wikipedia API\r\n=============\r\n\r\n``Wikipedia-API`` is easy to use Python wrapper for `Wikipedias'`_ API. It supports extracting texts, sections, links, categories, translations, etc from Wikipedia. Documentation provides code snippets for the most common use cases.\r\n\r\n.. _Wikipedias': https://www.mediawiki.org/wiki/API:Main_page\r\n\r\n|build-status| |docs| |cc-coverage| |version| |pyversions| |github-stars-flat|\r\n\r\nInstallation\r\n------------\r\n\r\nThis package requires at least Python 3.4 to install because it's using IntEnum.\r\n\r\n.. code-block:: python\r\n\r\n    pip3 install wikipedia-api\r\n\r\n\r\nUsage\r\n-----\r\n\r\nGoal of ``Wikipedia-API`` is to provide simple and easy to use API for retrieving informations from Wikipedia. Bellow are examples of common use cases.\r\n\r\nImporting\r\n~~~~~~~~~\r\n\r\n.. code-block:: python\r\n\r\n\timport wikipediaapi\r\n\r\nHow To Get Single Page\r\n~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nGetting single page is straightforward. You have to initialize ``Wikipedia`` object and ask for page by its name.\r\nTo initialize it, you have to provide:\r\n\r\n* `user_agent` to identify your project. Please follow the recommended `format`_.\r\n* `language` to specify language mutation. It has to be one of `supported languages`_.\r\n\r\n.. _format: https://meta.wikimedia.org/wiki/User-Agent_policy\r\n.. _supported languages: http://meta.wikimedia.org/wiki/List_of_Wikipedias\r\n\r\n.. code-block:: python\r\n\r\n    import wikipediaapi\r\n\twiki_wiki = wikipediaapi.Wikipedia('MyProjectName (merlin@example.com)', 'en')\r\n\r\n\tpage_py = wiki_wiki.page('Python_(programming_language)')\r\n\r\n\r\nHow To Check If Wiki Page Exists\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nFor checking, whether page exists, you can use function ``exists``.\r\n\r\n.. code-block:: python\r\n\r\n\tpage_py = wiki_wiki.page('Python_(programming_language)')\r\n\tprint(\"Page - Exists: %s\" % page_py.exists())\r\n\t# Page - Exists: True\r\n\r\n\tpage_missing = wiki_wiki.page('NonExistingPageWithStrangeName')\r\n\tprint(\"Page - Exists: %s\" % \tpage_missing.exists())\r\n\t# Page - Exists: False\r\n\r\nHow To Get Page Summary\r\n~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nClass ``WikipediaPage`` has property ``summary``, which returns description of Wiki page.\r\n\r\n.. code-block:: python\r\n\r\n\r\n    import wikipediaapi\r\n\twiki_wiki = wikipediaapi.Wikipedia('MyProjectName (merlin@example.com)', 'en')\r\n\r\n\tprint(\"Page - Title: %s\" % page_py.title)\r\n\t# Page - Title: Python (programming language)\r\n\r\n\tprint(\"Page - Summary: %s\" % page_py.summary[0:60])\r\n\t# Page - Summary: Python is a widely used high-level programming language for\r\n\r\n\r\nHow To Get Page URL\r\n~~~~~~~~~~~~~~~~~~~\r\n\r\n``WikipediaPage`` has two properties with URL of the page. It is ``fullurl`` and ``canonicalurl``.\r\n\r\n.. code-block:: python\r\n\r\n\tprint(page_py.fullurl)\r\n\t# https://en.wikipedia.org/wiki/Python_(programming_language)\r\n\r\n\tprint(page_py.canonicalurl)\r\n\t# https://en.wikipedia.org/wiki/Python_(programming_language)\r\n\r\nHow To Get Full Text\r\n~~~~~~~~~~~~~~~~~~~~\r\n\r\nTo get full text of Wikipedia page you should use property ``text`` which constructs text of the page\r\nas concatanation of summary and sections with their titles and texts.\r\n\r\n.. code-block:: python\r\n\r\n\twiki_wiki = wikipediaapi.Wikipedia(\r\n\t    user_agent='MyProjectName (merlin@example.com)',\r\n\t\tlanguage='en',\r\n\t\textract_format=wikipediaapi.ExtractFormat.WIKI\r\n\t)\r\n\r\n\tp_wiki = wiki_wiki.page(\"Test 1\")\r\n\tprint(p_wiki.text)\r\n\t# Summary\r\n\t# Section 1\r\n\t# Text of section 1\r\n\t# Section 1.1\r\n\t# Text of section 1.1\r\n\t# ...\r\n\r\n\r\n\twiki_html = wikipediaapi.Wikipedia(\r\n\t    user_agent='MyProjectName (merlin@example.com)',\r\n\t\tlanguage='en',\r\n\t\textract_format=wikipediaapi.ExtractFormat.HTML\r\n\t)\r\n\tp_html = wiki_html.page(\"Test 1\")\r\n\tprint(p_html.text)\r\n\t# <p>Summary</p>\r\n\t# <h2>Section 1</h2>\r\n\t# <p>Text of section 1</p>\r\n\t# <h3>Section 1.1</h3>\r\n\t# <p>Text of section 1.1</p>\r\n\t# ...\r\n\r\nHow To Get Page Sections\r\n~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nTo get all top level sections of page, you have to use property ``sections``. It returns list of\r\n``WikipediaPageSection``, so you have to use recursion to get all subsections.\r\n\r\n.. code-block:: python\r\n\r\n\tdef print_sections(sections, level=0):\r\n\t\tfor s in sections:\r\n\t\t\tprint(\"%s: %s - %s\" % (\"*\" * (level + 1), s.title, s.text[0:40]))\r\n\t\t\tprint_sections(s.sections, level + 1)\r\n\r\n\r\n\tprint_sections(page_py.sections)\r\n\t# *: History - Python was conceived in the late 1980s,\r\n\t# *: Features and philosophy - Python is a multi-paradigm programming l\r\n\t# *: Syntax and semantics - Python is meant to be an easily readable\r\n\t# **: Indentation - Python uses whitespace indentation, rath\r\n\t# **: Statements and control flow - Python's statements include (among other\r\n\t# **: Expressions - Some Python expressions are similar to l\r\n\r\nHow To Get Page Section By Title\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nTo get last section of page with given title, you have to use function ``section_by_title``.\r\nIt returns the last ``WikipediaPageSection`` with this title.\r\n\r\n.. code-block:: python\r\n\r\n\tsection_history = page_py.section_by_title('History')\r\n\tprint(\"%s - %s\" % (section_history.title, section_history.text[0:40]))\r\n\r\n\t# History - Python was conceived in the late 1980s b\r\n\r\nHow To Get All Page Sections By Title\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nTo get all sections of page with given title, you have to use function ``sections_by_title``.\r\nIt returns the all ``WikipediaPageSection`` with this title.\r\n\r\n.. code-block:: python\r\n\r\n\tpage_1920 = wiki_wiki.page('1920')\r\n\tsections_january = page_1920.sections_by_title('January')\r\n\tfor s in sections_january:\r\n\t    print(\"* %s - %s\" % (s.title, s.text[0:40]))\r\n\r\n    # * January - January 1\r\n    # Polish\u2013Soviet War in 1920: The\r\n    # * January - January 2\r\n    # Isaac Asimov, American author\r\n    # * January - January 1 \u2013 Zygmunt Gorazdowski, Polish\r\n\r\nHow To Get Page In Other Languages\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nIf you want to get other translations of given page, you should use property ``langlinks``. It is map,\r\nwhere key is language code and value is ``WikipediaPage``.\r\n\r\n.. code-block:: python\r\n\r\n\tdef print_langlinks(page):\r\n\t\tlanglinks = page.langlinks\r\n\t\tfor k in sorted(langlinks.keys()):\r\n\t\t    v = langlinks[k]\r\n\t\t    print(\"%s: %s - %s: %s\" % (k, v.language, v.title, v.fullurl))\r\n\r\n\tprint_langlinks(page_py)\r\n\t# af: af - Python (programmeertaal): https://af.wikipedia.org/wiki/Python_(programmeertaal)\r\n\t# als: als - Python (Programmiersprache): https://als.wikipedia.org/wiki/Python_(Programmiersprache)\r\n\t# an: an - Python: https://an.wikipedia.org/wiki/Python\r\n\t# ar: ar - \u0628\u0627\u064a\u062b\u0648\u0646: https://ar.wikipedia.org/wiki/%D8%A8%D8%A7%D9%8A%D8%AB%D9%88%D9%86\r\n\t# as: as - \u09aa\u09be\u0987\u09a5\u09a8: https://as.wikipedia.org/wiki/%E0%A6%AA%E0%A6%BE%E0%A6%87%E0%A6%A5%E0%A6%A8\r\n\r\n\tpage_py_cs = page_py.langlinks['cs']\r\n\tprint(\"Page - Summary: %s\" % page_py_cs.summary[0:60])\r\n\t# Page - Summary: Python (anglick\u00e1 v\u00fdslovnost [\u02c8pai\u03b8t\u0259n]) je vysoko\u00farov\u0148ov\u00fd sk\r\n\r\nHow To Get Links To Other Pages\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nIf you want to get all links to other wiki pages from given page, you need to use property ``links``.\r\nIt's map, where key is page title and value is ``WikipediaPage``.\r\n\r\n.. code-block:: python\r\n\r\n\tdef print_links(page):\r\n\t\tlinks = page.links\r\n\t\tfor title in sorted(links.keys()):\r\n\t\t    print(\"%s: %s\" % (title, links[title]))\r\n\r\n\tprint_links(page_py)\r\n\t# 3ds Max: 3ds Max (id: ??, ns: 0)\r\n\t# ?:: ?: (id: ??, ns: 0)\r\n\t# ABC (programming language): ABC (programming language) (id: ??, ns: 0)\r\n\t# ALGOL 68: ALGOL 68 (id: ??, ns: 0)\r\n\t# Abaqus: Abaqus (id: ??, ns: 0)\r\n\t# ...\r\n\r\nHow To Get Page Categories\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nIf you want to get all categories under which page belongs, you should use property ``categories``.\r\nIt's map, where key is category title and value is ``WikipediaPage``.\r\n\r\n.. code-block:: python\r\n\r\n\tdef print_categories(page):\r\n\t\tcategories = page.categories\r\n\t\tfor title in sorted(categories.keys()):\r\n\t\t    print(\"%s: %s\" % (title, categories[title]))\r\n\r\n\r\n\tprint(\"Categories\")\r\n\tprint_categories(page_py)\r\n\t# Category:All articles containing potentially dated statements: ...\r\n\t# Category:All articles with unsourced statements: ...\r\n\t# Category:Articles containing potentially dated statements from August 2016: ...\r\n\t# Category:Articles containing potentially dated statements from March 2017: ...\r\n\t# Category:Articles containing potentially dated statements from September 2017: ...\r\n\r\nHow To Get All Pages From Category\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nTo get all pages from given category, you should use property ``categorymembers``. It returns all members of given category.\r\nYou have to implement recursion and deduplication by yourself.\r\n\r\n.. code-block:: python\r\n\r\n\tdef print_categorymembers(categorymembers, level=0, max_level=1):\r\n\t\tfor c in categorymembers.values():\r\n\t\t    print(\"%s: %s (ns: %d)\" % (\"*\" * (level + 1), c.title, c.ns))\r\n\t\t    if c.ns == wikipediaapi.Namespace.CATEGORY and level < max_level:\r\n\t\t        print_categorymembers(c.categorymembers, level=level + 1, max_level=max_level)\r\n\r\n\r\n\tcat = wiki_wiki.page(\"Category:Physics\")\r\n\tprint(\"Category members: Category:Physics\")\r\n\tprint_categorymembers(cat.categorymembers)\r\n\r\n\t# Category members: Category:Physics\r\n\t# * Statistical mechanics (ns: 0)\r\n\t# * Category:Physical quantities (ns: 14)\r\n\t# ** Refractive index (ns: 0)\r\n\t# ** Vapor quality (ns: 0)\r\n\t# ** Electric susceptibility (ns: 0)\r\n\t# ** Specific weight (ns: 0)\r\n\t# ** Category:Viscosity (ns: 14)\r\n\t# *** Brookfield Engineering (ns: 0)\r\n\r\nHow To See Underlying API Call\r\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\nIf you have problems with retrieving data you can get URL of undrerlying API call.\r\nThis will help you determine if the problem is in the library or somewhere else.\r\n\r\n.. code-block:: python\r\n\r\n    import wikipediaapi\r\n    import sys\r\n    wikipediaapi.log.setLevel(level=wikipediaapi.logging.DEBUG)\r\n\r\n    # Set handler if you use Python in interactive mode\r\n    out_hdlr = wikipediaapi.logging.StreamHandler(sys.stderr)\r\n    out_hdlr.setFormatter(wikipediaapi.logging.Formatter('%(asctime)s %(message)s'))\r\n    out_hdlr.setLevel(wikipediaapi.logging.DEBUG)\r\n    wikipediaapi.log.addHandler(out_hdlr)\r\n\r\n    wiki = wikipediaapi.Wikipedia(user_agent='MyProjectName (merlin@example.com)', language='en')\r\n\r\n    page_ostrava = wiki.page('Ostrava')\r\n    print(page_ostrava.summary)\r\n    # logger prints out: Request URL: http://en.wikipedia.org/w/api.php?action=query&prop=extracts&titles=Ostrava&explaintext=1&exsectionformat=wiki\r\n\r\nExternal Links\r\n--------------\r\n\r\n* `GitHub`_\r\n* `PyPi`_\r\n* `Travis`_\r\n* `ReadTheDocs`_\r\n\r\n.. _GitHub: https://github.com/martin-majlis/Wikipedia-API/\r\n.. _PyPi: https://pypi.python.org/pypi/Wikipedia-API/\r\n.. _Travis: https://travis-ci.org/martin-majlis/Wikipedia-API/\r\n.. _ReadTheDocs: http://wikipedia-api.readthedocs.io/\r\n\r\nOther Badges\r\n------------\r\n\r\n|cc-badge| |cc-issues| |coveralls| |version| |pyversions| |implementations|\r\n|github-downloads| |github-tag| |github-release|\r\n|github-commits-since-latest| |github-forks| |github-stars| |github-watches|\r\n|github-commit-activity| |github-last-commit| |github-code-size| |github-repo-size|\r\n|pypi-license| |pypi-wheel| |pypi-format| |pypi-pyversions| |pypi-implementations|\r\n|pypi-status| |pypi-downloads-dd| |pypi-downloads-dw| |pypi-downloads-dm|\r\n|libraries-io-sourcerank| |libraries-io-dependent-repos|\r\n\r\n\r\nOther Pages\r\n-----------\r\n\r\n\r\n\r\n\r\n.. |build-status| image:: https://travis-ci.org/martin-majlis/Wikipedia-API.svg?branch=master\r\n    :alt: build status\r\n    :target: https://travis-ci.org/martin-majlis/Wikipedia-API\r\n\r\n.. |docs| image:: https://readthedocs.org/projects/wikipedia-api/badge/?version=latest\r\n    :target: http://wikipedia-api.readthedocs.io/en/latest/?badge=latest\r\n    :alt: Documentation Status\r\n\r\n.. |cc-badge| image:: https://codeclimate.com/github/martin-majlis/Wikipedia-API/badges/gpa.svg\r\n    :target: https://codeclimate.com/github/martin-majlis/Wikipedia-API\r\n    :alt: Code Climate\r\n\r\n.. |cc-issues| image:: https://codeclimate.com/github/martin-majlis/Wikipedia-API/badges/issue_count.svg\r\n    :target: https://codeclimate.com/github/martin-majlis/Wikipedia-API\r\n    :alt: Issue Count\r\n\r\n.. |cc-coverage| image:: https://api.codeclimate.com/v1/badges/6e2c24d72438b39e5c26/test_coverage\r\n    :target: https://codeclimate.com/github/martin-majlis/Wikipedia-API\r\n    :alt: Test Coverage\r\n\r\n.. |coveralls| image:: https://coveralls.io/repos/github/martin-majlis/Wikipedia-API/badge.svg?branch=master\r\n\t:target: https://coveralls.io/github/martin-majlis/Wikipedia-API?branch=master\r\n\t:alt: Coveralls\r\n\r\n.. |version| image:: https://img.shields.io/pypi/v/wikipedia-api.svg?style=flat\r\n\t:target: https://pypi.python.org/pypi/Wikipedia-API\r\n\t:alt: Version\r\n\r\n.. |pyversions| image:: https://img.shields.io/pypi/pyversions/wikipedia-api.svg?style=flat\r\n\t:target: https://pypi.python.org/pypi/Wikipedia-API\r\n\t:alt: Py Versions\r\n\r\n.. |implementations| image:: https://img.shields.io/pypi/implementation/wikipedia-api.svg?style=flat\r\n    :target: https://pypi.python.org/pypi/Wikipedia-API\r\n\t:alt: Implementations\r\n\r\n.. |github-downloads| image:: https://img.shields.io/github/downloads/martin-majlis/Wikipedia-API/total.svg\r\n\t:target: https://github.com/martin-majlis/Wikipedia-API/releases\r\n\t:alt: Downloads\r\n\r\n.. |github-tag| image:: https://img.shields.io/github/tag/martin-majlis/Wikipedia-API.svg\r\n\t:target: https://github.com/martin-majlis/Wikipedia-API/tags\r\n\t:alt: Tags\r\n\r\n.. |github-release| image:: https://img.shields.io/github/release/martin-majlis/Wikipedia-API.svg\r\n\t:target: https://github.com/martin-majlis/Wikipedia-API/\r\n\r\n.. |github-commits-since-latest| image:: https://img.shields.io/github/commits-since/martin-majlis/Wikipedia-API/latest.svg\r\n\t:target: https://github.com/martin-majlis/Wikipedia-API/\r\n\t:alt: Github commits (since latest release)\r\n\r\n.. |github-forks| image:: https://img.shields.io/github/forks/martin-majlis/Wikipedia-API.svg?style=social&label=Fork\r\n\t:target: https://github.com/martin-majlis/Wikipedia-API/\r\n\t:alt: GitHub forks\r\n\r\n.. |github-stars| image:: https://img.shields.io/github/stars/martin-majlis/Wikipedia-API.svg?style=social&label=Stars\r\n\t:target: https://github.com/martin-majlis/Wikipedia-API/\r\n\t:alt: GitHub stars\r\n\r\n.. |github-stars-flat| image:: https://img.shields.io/github/stars/martin-majlis/Wikipedia-API.svg?style=flat&label=Stars\r\n\t:target: https://github.com/martin-majlis/Wikipedia-API/\r\n\t:alt: GitHub stars\r\n\r\n.. |github-watches| image:: https://img.shields.io/github/watchers/martin-majlis/Wikipedia-API.svg?style=social&label=Watch\r\n\t:target: https://github.com/martin-majlis/Wikipedia-API/\r\n\t:alt: GitHub watchers\r\n\r\n.. |github-commit-activity| image:: https://img.shields.io/github/commit-activity/y/martin-majlis/Wikipedia-API.svg\r\n\t:target: https://github.com/martin-majlis/Wikipedia-API/commits/master\r\n\t:alt: GitHub commit activity the past week, 4 weeks, year\r\n\r\n.. |github-last-commit| image:: https://img.shields.io/github/commits/martin-majlis/Wikipedia-API/last.svg\r\n\t:target: https://github.com/martin-majlis/Wikipedia-API/\r\n\t:alt: Last commit\r\n\r\n.. |github-code-size| image:: https://img.shields.io/github/languages/code-size/martin-majlis/Wikipedia-API.svg\r\n\t:target: https://github.com/martin-majlis/Wikipedia-API/\r\n\t:alt: GitHub code size in bytes\r\n\r\n.. |github-repo-size| image:: https://img.shields.io/github/repo-size/martin-majlis/Wikipedia-API.svg\r\n\t:target: https://github.com/martin-majlis/Wikipedia-API/\r\n\t:alt: GitHub repo size in bytes\r\n\r\n.. |pypi-license| image:: https://img.shields.io/pypi/l/Wikipedia-API.svg\r\n\t:target: https://pypi.python.org/pypi/Wikipedia-API/\r\n\t:alt: PyPi License\r\n\r\n.. |pypi-wheel| image:: https://img.shields.io/pypi/wheel/Wikipedia-API.svg\r\n\t:target: https://pypi.python.org/pypi/Wikipedia-API/\r\n\t:alt: PyPi Wheel\r\n\r\n.. |pypi-format| image:: https://img.shields.io/pypi/format/Wikipedia-API.svg\r\n\t:target: https://pypi.python.org/pypi/Wikipedia-API/\r\n\t:alt: PyPi Format\r\n\r\n.. |pypi-pyversions| image:: https://img.shields.io/pypi/pyversions/Wikipedia-API.svg\r\n\t:target: https://pypi.python.org/pypi/Wikipedia-API/\r\n\t:alt: PyPi PyVersions\r\n\r\n.. |pypi-implementations| image:: https://img.shields.io/pypi/implementation/Wikipedia-API.svg\r\n\t:target: https://pypi.python.org/pypi/Wikipedia-API/\r\n\t:alt: PyPi Implementations\r\n\r\n.. |pypi-status| image:: https://img.shields.io/pypi/status/Wikipedia-API.svg\r\n\t:target: https://pypi.python.org/pypi/Wikipedia-API/\r\n\t:alt: PyPi Status\r\n\r\n.. |pypi-downloads-dd| image:: https://img.shields.io/pypi/dd/Wikipedia-API.svg\r\n\t:target: https://pypi.python.org/pypi/Wikipedia-API/\r\n\t:alt: PyPi Downloads - Day\r\n\r\n.. |pypi-downloads-dw| image:: https://img.shields.io/pypi/dw/Wikipedia-API.svg\r\n\t:target: https://pypi.python.org/pypi/Wikipedia-API/\r\n\t:alt: PyPi Downloads - Week\r\n\r\n.. |pypi-downloads-dm| image:: https://img.shields.io/pypi/dm/Wikipedia-API.svg\r\n\t:target: https://pypi.python.org/pypi/Wikipedia-API/\r\n\t:alt: PyPi Downloads - Month\r\n\r\n.. |libraries-io-sourcerank| image:: https://img.shields.io/librariesio/sourcerank/pypi/Wikipedia-API.svg\r\n\t:target: https://libraries.io/pypi/Wikipedia-API\r\n\t:alt: Libraries.io - SourceRank\r\n\r\n.. |libraries-io-dependent-repos| image:: https://img.shields.io/librariesio/dependent-repos/pypi/Wikipedia-API.svg\r\n\t:target: https://libraries.io/pypi/Wikipedia-API\r\n\t:alt: Libraries.io - Dependent Repos\r\n\r\n\r\nChangelog\r\n=========\r\n\r\n0.5.8\r\n-----\r\n\r\n* Adds support for retrieving all sections with given name - `Issue 39`_\r\n\r\n.. _Issue 39: https://github.com/martin-majlis/Wikipedia-API/issues/39\r\n\r\n0.5.4\r\n-----\r\n\r\n* Namespace could be arbitrary integer - `Issue 29`_\r\n\r\n.. _Issue 29: https://github.com/martin-majlis/Wikipedia-API/issues/29\r\n\r\n\r\n0.5.3\r\n-----\r\n\r\n* Adds persistent HTTP connection - `Issue 26`_\r\n    * Downloading 50 pages reduced from 13s to 8s => 40% speed up\r\n\r\n.. _Issue 26: https://github.com/martin-majlis/Wikipedia-API/issues/26\r\n\r\n\r\n0.5.2\r\n-----\r\n\r\n* Adds namespaces 102 - 105 - `Issue 24`_\r\n\r\n.. _Issue 24: https://github.com/martin-majlis/Wikipedia-API/issues/24\r\n\r\n0.5.1\r\n-----\r\n\r\n* Adds tox for testing different Python versions\r\n\r\n0.5.0\r\n-----\r\n\r\n* Allows modifying API call parameters\r\n* Fixes `Issue 16`_ - hidden categories\r\n* Fixes `Issue 21`_ - summary extraction\r\n\r\n.. _Issue 16: https://github.com/martin-majlis/Wikipedia-API/issues/16\r\n.. _Issue 21: https://github.com/martin-majlis/Wikipedia-API/issues/21\r\n\r\n\r\n0.4.5\r\n-----\r\n\r\n* Handles missing sections correctly\r\n* Fixes `Issue 20`_\r\n\r\n.. _Issue 20: https://github.com/martin-majlis/Wikipedia-API/issues/20\r\n\r\n\r\n0.4.4\r\n-----\r\n* Uses HTTPS directly instead of HTTP to avoid redirect\r\n\r\n0.4.3\r\n-----\r\n* Correctly extracts text from pages without sections\r\n* Adds support for quoted page titles\r\n\r\n.. code:: python\r\n\r\n    api = wikipediaapi.Wikipedia(\r\n        language='hi',\r\n    )\r\n    python = api.article(\r\n        title='%E0%A4%AA%E0%A4%BE%E0%A4%87%E0%A4%A5%E0%A4%A8',\r\n        unquote=True,\r\n    )\r\n    print(python.summary)\r\n\r\n0.4.2\r\n-----\r\n* Adds support for Python 3.4 by not using f-strings\r\n\r\n0.4.1\r\n-----\r\n* Uses code style enforced by flake8\r\n* Increased code coverage\r\n\r\n0.4.0\r\n-----\r\n* Uses type annotations => minimal requirement is now Python 3.5\r\n* Adds possibility to use more parameters for `request`_. For example:\r\n\r\n.. code:: python\r\n\r\n    api = wikipediaapi.Wikipedia(\r\n        language='en',\r\n        proxies={'http': 'http://localhost:1234'}\r\n    )\r\n\r\n* Extends documentation\r\n\r\n.. _request: http://docs.python-requests.org/en/master/api/#requests.request\r\n\r\n0.3.4\r\n-----\r\n* Adds support for `property Categorymembers`_\r\n* Adds property ``text`` for retrieving complete text of the page\r\n\r\n.. _property Categorymembers: https://www.mediawiki.org/wiki/API:Categorymembers\r\n\r\n0.3.3\r\n-----\r\n* Added support for `request timeout`_\r\n* Add header: Accept-Encoding: gzip\r\n\r\n.. _request timeout: https://github.com/martin-majlis/Wikipedia-API/issues/1\r\n\r\n0.3.2\r\n-----\r\n* Added support for `property Categories`_\r\n\r\n.. _property Categories: https://www.mediawiki.org/wiki/API:Categories\r\n\r\n0.3.1\r\n-----\r\n* Removing ``WikipediaLangLink``\r\n* Page keeps track of its own language, so it's easier to jump between different translations of the same page\r\n\r\n0.3.0\r\n-----\r\n* Rename directory from ``wikipedia`` to ``wikipediaapi`` to avoid collisions\r\n\r\n0.2.4\r\n-----\r\n* Handle redirects properly\r\n\r\n0.2.3\r\n-----\r\n* Usage method ``page`` instead of ``article`` in ``Wikipedia``\r\n\r\n0.2.2\r\n-----\r\n* Added support for `property Links`_\r\n\r\n.. _property Links: https://www.mediawiki.org/wiki/API:Links\r\n\r\n0.2.1\r\n-----\r\n* Added support for `property Langlinks`_\r\n\r\n.. _property Langlinks: https://www.mediawiki.org/wiki/API:Langlinks\r\n\r\n0.2.0\r\n-----\r\n* Use properties instead of functions\r\n* Added support for `property Info`_\r\n\r\n.. _property Info: https://www.mediawiki.org/wiki/API:Info\r\n\r\n0.1.6\r\n-----\r\n* Support for extracting texts with HTML markdown\r\n* Added initial version of unit tests\r\n\r\n0.1.4\r\n-----\r\n* It's possible to extract summary and sections of the page\r\n* Added support for `property Extracts`_\r\n\r\n.. _property Extracts: https://www.mediawiki.org/wiki/Extension:TextExtracts#API\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python Wrapper for Wikipedia",
    "version": "0.6.0",
    "project_urls": {
        "Download": "https://github.com/martin-majlis/Wikipedia-API/archive/master.tar.gz",
        "Homepage": "https://github.com/martin-majlis/Wikipedia-API"
    },
    "split_keywords": [
        "wikipedia",
        "api",
        "wrapper"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2f3f919727b460d88c899d110f98d1a0c415264b5d8ad8176f14ce7ad9db0e3b",
                "md5": "2f3ff55aa91350d4ccf378c43d82ab2c",
                "sha256": "6dfd6b3b680e342a3843fe954049c5784c1a67fadc0060f9d1696d1d0e41ecfb"
            },
            "downloads": -1,
            "filename": "Wikipedia_API-0.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2f3ff55aa91350d4ccf378c43d82ab2c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 14352,
            "upload_time": "2023-06-29T21:53:40",
            "upload_time_iso_8601": "2023-06-29T21:53:40.995976Z",
            "url": "https://files.pythonhosted.org/packages/2f/3f/919727b460d88c899d110f98d1a0c415264b5d8ad8176f14ce7ad9db0e3b/Wikipedia_API-0.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0ba5ae546250aaec1c6b5b4bab7cc97f07a47587f09c942f086d614ecdeeb422",
                "md5": "6229d48ae640305a6c7b57c108bdb92d",
                "sha256": "61e94921cca9ec68e92aa5f258261d6a88b7baa960f9acfcb0c9c2c525dcb3ff"
            },
            "downloads": -1,
            "filename": "Wikipedia-API-0.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6229d48ae640305a6c7b57c108bdb92d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 17167,
            "upload_time": "2023-06-29T21:53:42",
            "upload_time_iso_8601": "2023-06-29T21:53:42.998152Z",
            "url": "https://files.pythonhosted.org/packages/0b/a5/ae546250aaec1c6b5b4bab7cc97f07a47587f09c942f086d614ecdeeb422/Wikipedia-API-0.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-29 21:53:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "martin-majlis",
    "github_project": "Wikipedia-API",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "wikipedia-api"
}
        
Elapsed time: 0.17708s