A modern async Wikipedia API client
Project description
Modern Wikipedia API Client
A async Wikipedia API client with advanced features for professional use.
Features
- Async/Await Support: Built with
aiohttpfor high-performance async operations - Automatic Rate Limiting: Configurable rate limiting with smart backoff
- Retry Logic: Exponential backoff with jitter for robust error handling
- Caching: Time-based caching with TTL support
- Multi-language Support: Easy language switching
- Batch Operations: Optimized batch requests for multiple pages
- Type Safety: Full type annotations with Pydantic models
- Error Handling: Comprehensive error hierarchy
- Production Ready: Optimal defaults for production use
Quick Start
Installation
pip install wikipedia-async
import asyncio
from wikipedia_async import WikipediaClient
async def main():
# Initialize client with optimal defaults
client = WikipediaClient()
# Search for articles
results = await client.search("Python programming")
# Get page content
page = await client.get_page("Python (programming language)")
print(f"Title: {page.title}")
print(f"Summary: {page.summary[:200]}...")
# Batch operations
pages = await client.get_pages_batch(["Python", "JavaScript", "Rust"])
await client.close()
if __name__ == "__main__":
asyncio.run(main())
Configuration
from wikipedia_async import WikipediaClient, ClientConfig
config = ClientConfig(
language="en",
rate_limit_calls=10,
rate_limit_period=1.0,
max_retries=3,
cache_ttl=300, # 5 minutes
timeout=30.0,
max_concurrent_requests=10
)
client = WikipediaClient(config=config)
See Docs Here
See Examples Here
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wikipedia_async-0.5.0.tar.gz
(88.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file wikipedia_async-0.5.0.tar.gz.
File metadata
- Download URL: wikipedia_async-0.5.0.tar.gz
- Upload date:
- Size: 88.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
341e8371ee3294edef53990451f1ad7c87bce06ec871daea92f9d7b737df4d79
|
|
| MD5 |
2b36495fb020a5b825882a537d8e1515
|
|
| BLAKE2b-256 |
6efe8e888e759559f6a5c6f9b4d9ae0ebc32610f09db3ba3c331d52dcde21fe6
|
File details
Details for the file wikipedia_async-0.5.0-py3-none-any.whl.
File metadata
- Download URL: wikipedia_async-0.5.0-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
273b7903c204458293558ba4f05898d441f1c078ddaa4f08407ed01235a06e53
|
|
| MD5 |
39dc61be95eff1ddb5171d7564ca6e21
|
|
| BLAKE2b-256 |
1d1545cab1a8aa45364c4a10b66f3f5b0a64a645148a472631aebb1b5cbe8040
|