Wikipedia-API
Python Wrapper for Wikipedia
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-apiuv
uv add wikipedia-apipoetry
poetry add wikipedia-apiInstalling 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
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
wikipediaProvides simple Python access to Wikipedia…
permissive · top 5,000 on PyPI
wikipedia-mcpExposes Wikipedia search, article retrieval,…
permissive · top 15,000 on PyPI
pywikibotPywikibot is a Python framework that interfaces…
permissive · top 15,000 on PyPI
mwclientmwclient is a Python client library for the…
permissive · top 15,000 on PyPI
mwparserfromhellParses MediaWiki wikicode into a queryable…
permissive · top 5,000 on PyPI
mwxmlEfficiently parse and stream-process MediaWiki…
permissive · top 15,000 on PyPI
algoliasearchA Python HTTP client for interacting with…
permissive · top 5,000 on PyPI
mwtypesProvides standardized Python classes for…
permissive · top 15,000 on PyPI
trec-car-toolsProvides Python and Java bindings to read TREC…
permissive · top 15,000 on PyPI
waybackpyWaybackpy provides Python and CLI access to the…
permissive · top 5,000 on PyPI