Python client library for the ICE List Wiki API
Project description
ICE List Wiki Python SDK
Python client library for the ICE List Wiki API.
Installation
pip install icelist-sdk
Quick Start
from icelist import IceListClient
# Initialize client
client = IceListClient()
# Search for content
results = client.search("Timothy Donahue")
for result in results:
print(f"{result['title']}: {result['snippet']}")
# Get a specific page
page = client.get_page("Donahue,_Timothy")
print(page['title'])
print(page['extract']) # First paragraph
# Get full page content
content = client.get_page_content("Main_Page")
print(content['wikitext']) # Raw wikitext
print(content['html']) # Rendered HTML
# List category members
agents = client.get_category_members("Agents", limit=50)
for agent in agents:
print(agent['title'])
# Get recent changes
changes = client.get_recent_changes(limit=10)
for change in changes:
print(f"{change['title']} - {change['timestamp']}")
API Reference
IceListClient(base_url=None, user_agent=None, timeout=30)
Main client class for interacting with the ICE List Wiki API.
Parameters:
base_url(str, optional): Base URL of the wiki. Default:https://wiki.icelist.isuser_agent(str, optional): Custom user agent stringtimeout(int, optional): Request timeout in seconds. Default: 30
Methods
search(query, limit=10)
Search for pages matching a query.
Returns: List of search results with title, snippet, timestamp
get_page(title)
Get basic information about a page (title, extract, URL).
Returns: Dict with page metadata
get_page_content(title)
Get full page content in both wikitext and HTML.
Returns: Dict with wikitext and rendered HTML
get_category_members(category, limit=50)
List all pages in a category.
Returns: List of pages in the category
get_recent_changes(limit=50)
Get recent changes to the wiki.
Returns: List of recent changes with metadata
Error Handling
from icelist import IceListClient, IceListAPIError
client = IceListClient()
try:
page = client.get_page("NonexistentPage")
except IceListAPIError as e:
print(f"API Error: {e.message} (Code: {e.code})")
Development
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Type checking
mypy icelist
Requirements
- Python 3.8+
- requests library
License
MIT License
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
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 icelist_sdk-0.1.0.tar.gz.
File metadata
- Download URL: icelist_sdk-0.1.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a130eb2e5fa3ae6be3058681ff961968a094f389b5424e11ab3528131d10f7ca
|
|
| MD5 |
ba867178f2ae4edbc7895d92073e1dec
|
|
| BLAKE2b-256 |
fd6c231eb30707da34bb99f5c007c8ef1fe398ff3830cce4579f7a533c2f865c
|
File details
Details for the file icelist_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: icelist_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ceed5c5c52a80d6ceeff2a0278cb34d33dcda1988bb6dc86a6376f7d713eada
|
|
| MD5 |
00fc6f72d16b35828792e33d9950bf2f
|
|
| BLAKE2b-256 |
498be1d48513a8468f0d20a0e766f21efed488c3a68cbbde931dc0ccab5ed65d
|