skillfed

Wikipedia-API

Python Wrapper for Wikipedia

wikipedia-api v0.15.0 19.1M downloads/30d#1,073 on PyPI746
Permissive license MIT Active released

What it is and what it does

Wikipedia-API wraps Wikipedia's MediaWiki API to let you programmatically fetch and parse Wikipedia pages. It provides both a synchronous Wikipedia client and an asynchronous AsyncWikipedia client, so you can choose blocking or non-blocking I/O depending on your application's needs. You initialize a client with a user-agent string and language code, then call .page() to retrieve a page object. From there you can access the page's summary, full text, sections with recursion support, links, categories, translations, and metadata like URLs and page IDs. The library handles underlying HTTP requests via httpx and uses tenacity for retry logic.

The synchronous API returns data directly from properties like page.summary and page.text, while the async API makes those same properties awaitable coroutines. Both APIs support extracting text in wiki markup or HTML format. The library is actively maintained, supports Python 3.10 and later, and has no known security vulnerabilities.

Use it for:

  • Scrape Wikipedia summaries and full article text for knowledge base or research tools
  • Build a chatbot or Q&A system that retrieves Wikipedia content to answer user queries
  • Extract page sections and structure for content analysis or document processing pipelines
  • Fetch Wikipedia links and categories to build knowledge graphs or topic relationship maps
  • Integrate Wikipedia data into async applications without blocking the event loop

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Wikipedia-API is a Python wrapper for Wikipedia's MediaWiki API that retrieves page content, sections, links, categories, and metadata in both synchronous and asynchronous modes.

Yes. The package is actively maintained, has no security vulnerabilities, uses a permissive MIT license, and installs with low friction. It's well-suited for any project that needs to programmatically access Wikipedia content. The dual sync/async API design makes it flexible for both simple scripts and production async applications.

Install

wikipedia-api on PyPI

pip

pip install wikipedia-api

uv

uv add wikipedia-api

poetry

poetry add wikipedia-api

Installing Wikipedia-API

Before you install

Low friction install with three lightweight runtime dependencies (click, httpx, tenacity). Active maintenance with a recent release 80 days ago and 746 repository stars. Requires Python 3.10 or later.

License in practice

MIT license (permissive) — you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install wikipedia-api

import wikipediaapi
wiki = wikipediaapi.Wikipedia(user_agent='MyProject (contact@example.com)', language='en')
page = wiki.page('Python_(programming_language)')
print(page.summary)

Requires Python 3.10 or later; user-agent must include contact information per Wikimedia Foundation policy.

Verify before relying

  • Rate limiting or throttling behavior when making repeated Wikipedia API calls
  • Handling of Wikipedia redirects and disambiguation pages
  • Performance characteristics for large-scale batch page retrieval

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 3 — click, httpx, tenacity
Maintenance actively maintained — 80 days since the last release
Last repo commit
First released
Downloads 19,140,409/month — #1,073 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: wikipedia_api-0.15.0-py3-none-any.whl

Keywords: API, Wikipedia, wrapper

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Communications :: EmailTopic :: Software Development :: Libraries :: Python Modules

Tags

wikipedia api wrapper pythonfetch wikipedia page contentwikipedia async clientextract wikipedia text sectionswikipedia page metadata retrievalmediawiki api python wrapperwikipedia page summary extraction
wikipedia-integrationasync-supportweb-scraping

More Python Modules packages