Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow usage of wikipedia.summary() with a pageid rather than a title #182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions wikipedia/wikipedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ def random(pages=1):


@cache
def summary(title, sentences=0, chars=0, auto_suggest=True, redirect=True):
def summary(title=None, pageid=None, sentences=0, chars=0, auto_suggest=True, redirect=True):
'''
Plain text summary of the page.
Plain text summary of the page with title `title` or the pageid `pageid` (mutually exclusive).

.. note:: This is a convenience wrapper - auto_suggest and redirect are enabled by default

Expand All @@ -228,7 +228,7 @@ def summary(title, sentences=0, chars=0, auto_suggest=True, redirect=True):

# use auto_suggest and redirect to get the correct article
# also, use page's error checking to raise DisambiguationError if necessary
page_info = page(title, auto_suggest=auto_suggest, redirect=redirect)
page_info = page(title, pageid, auto_suggest=auto_suggest, redirect=redirect)
title = page_info.title
pageid = page_info.pageid

Expand Down