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

API warning on get() even with silent=True #118

Closed
cmoen opened this issue Apr 9, 2018 · 6 comments
Closed

API warning on get() even with silent=True #118

cmoen opened this issue Apr 9, 2018 · 6 comments
Assignees
Labels

Comments

@cmoen
Copy link

cmoen commented Apr 9, 2018

Thanks for wptools. I'm using version 0.4.11 and I'm getting a warning on get() and I'm wondering if there's a way this can be suppressed or otherwise worked-around.

Here's a way to reproduce this warning:

% python3
Python 3.6.5 (default, Mar 30 2018, 06:41:53) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import wptools
>>> page = wptools.page(wikibase='Q7754406', silent=True)
>>> page.get()
API warning: {'extracts': {'warnings': 'HTML may be malformed and/or unbalanced and may omit inline images. Use at your own risk. Known problems are listed at https://www.mediawiki.org/wiki/Extension:TextExtracts#Caveats.'}}
<wptools.page.WPToolsPage object at 0x109130630>

In my case, I don't really need extracts, but I would like to get many of the other data points that are captured by get_query() behind the scenes.

Is there a different way I should do my get calls to prevent extracts from outputting all these warnings in my stderr?

@siznax siznax self-assigned this Apr 9, 2018
@siznax
Copy link
Owner

siznax commented Apr 9, 2018

Thanks for trying wptools, @cmoen! I'll see if we can adjust our API query to avoid that warning, or provide a way to suppress warning messages.

@siznax siznax changed the title API warning on get() API warning on get() even with silent=True Apr 10, 2018
@siznax
Copy link
Owner

siznax commented Apr 10, 2018

It looks like your API query is valid, so no change there. But we should always respect the silent flag, even with API warnings, so I made that change. Thanks for opening the issue @cmoen!

@siznax siznax closed this as completed Apr 10, 2018
@siznax siznax added the Bug label Apr 10, 2018
@cmoen
Copy link
Author

cmoen commented Apr 10, 2018

Thanks for looking into this so quickly. I've built my code against the master branch and I can confirm that this seems to be working according to expectations. Thanks again.

@peeter-t2
Copy link

Thanks for the fix, I encountered the same problem. Just a note - upgrading via pip did not help to correct this, but replacing the files from master fixed it for me too.

@siznax
Copy link
Owner

siznax commented Apr 29, 2018

FYI, I made point release v0.4.12 for this fix, so you should be able to pip install --upgrade wptools for this now.

Thanks for the reminder @peeter-t2!

@peeter-t2
Copy link

Thanks!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants