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

fix suggest #85

Merged
merged 1 commit into from Sep 3, 2020
Merged

fix suggest #85

merged 1 commit into from Sep 3, 2020

Conversation

rubabredwan
Copy link
Contributor

Currently the suggest function returns the suggested title even if the searched title exists. For example, although the page Charli D'Amelio exists, page(r"Charli D'Amelio") returns an error because suggest changes the query to charlie d amelia

Traceback (most recent call last):
  File "paths.py", line 39, in <module>
    page = wikipedia.page(r"Charli D'Amelio")
  File "/usr/local/lib/python3.8/site-packages/mediawiki/mediawiki.py", line 842, in page
    return MediaWikiPage(self, title, redirect=redirect, preload=preload)
  File "/usr/local/lib/python3.8/site-packages/mediawiki/mediawikipage.py", line 85, in __init__
    self.__load(redirect=redirect, preload=preload)
  File "/usr/local/lib/python3.8/site-packages/mediawiki/mediawikipage.py", line 521, in __load
    self._raise_page_error()
  File "/usr/local/lib/python3.8/site-packages/mediawiki/mediawikipage.py", line 536, in _raise_page_error
    raise PageError(title=self.title)
mediawiki.exceptions.PageError: "charlie d amelia" does not match any pages. Try another query!

Fixing it so that the suggest function returns the searched title if it exists, and then the suggested one.

@barrust barrust merged commit 05e9f2c into barrust:master Sep 3, 2020
@barrust barrust mentioned this pull request Oct 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants