jayvdb created this task. jayvdb assigned this task to VcamX. jayvdb added subscribers: jayvdb, Aklapper. jayvdb added projects: Pywikibot-OAuth, Pywikibot-network, pywikibot-core. Restricted Application added a subscriber: pywikipedia-bugs.
TASK DESCRIPTION To add OAuth support to pywikibot, we need to add OAuth to httplib2 or allow and alternative http client such as python-requests.
This task is to evaluate the second alternative in more detail.
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, jayvdb Cc: Aklapper, jayvdb, pywikipedia-bugs
jayvdb added a blocking task: T98439: Add support for using python-requests.
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, jayvdb Cc: Aklapper, jayvdb, pywikipedia-bugs
Ricordisamoa added a subscriber: Ricordisamoa.
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, Ricordisamoa Cc: Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
VcamX added a comment.
@jayvdb This is the travis ci test report https://travis-ci.org/VcamX/pywikibot-core/builds/63499094. I reviewed the patch and also tried to follow its idea but found it break some internal things. So I made the patch myself. I checkouted a new branch https://github.com/VcamX/pywikibot-core/tree/requests based on the commit https://github.com/wikimedia/pywikibot-core/commit/ddb553f267d3af3fa5eedda00103a70b79f7fa75 from master branch, which showed itself pass the test https://travis-ci.org/wikimedia/pywikibot-core/builds/63069436 on travis ci.
Test 7 https://travis-ci.org/VcamX/pywikibot-core/jobs/63499106 and 8 https://travis-ci.org/VcamX/pywikibot-core/jobs/63499111 failed because requests introduced some warning to stderr, which cause some `assertIsNone(stderr_other)` failed. So I think we could ignore this assertion error.
Test 12 https://travis-ci.org/VcamX/pywikibot-core/jobs/63499123 failed because `AssertionError: LockedPage not raised by save`. I think this test is for non-sysop account. But pywikibot doesn't figure out my account is sysop, so not to skip this test, which cause saving a locked page succeed.
I almost replaced httplib2 with requests. And I removed some tests for httplib2, also modified some test case to fit with requests lib. You could check those modification. Sorry about those small and messy commits. I could squash them If you want :)
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX Cc: Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
XZise added a subscriber: XZise. XZise added a comment.
Hi @VcamX github allows you to compare your branch with the master branch relatively easy (at least if you rebase your changes only): https://github.com/wikimedia/pywikibot-core/compare/master...VcamX:requests
Regarding the error that `LockedPage`: The username and not sysop username is defined in the `.travis.yml` file so afaik all tests on Travis assume the test is not done by a sysop account. If you configure a sysop account in pywikibot as a normal user account it assumes that this account is not a sysop account. There is practically no reliable way to determine if your account is a sysop account which is why @jayvdb is working on a patch (or actually has submitted it already) which tries to avoid this difference (see also https://phabricator.wikimedia.org/T71283). I guess noone is using a sysop account to be run on Travis which so we didn't noticed that yet. In theory you could change in your `.travis.yml` that it also defines `sysopusernames` although better would be to change that test to check if the configured user has the permission to edit that page.
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, XZise Cc: XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
jayvdb added a comment.
In https://phabricator.wikimedia.org/T98671#1301633, @VcamX wrote:
Test 7 https://travis-ci.org/VcamX/pywikibot-core/jobs/63499106 and 8 https://travis-ci.org/VcamX/pywikibot-core/jobs/63499111 failed because requests introduced some warning to stderr, which cause some `assertIsNone(stderr_other)` failed. So I think we could ignore this assertion error.
I agree this assertion is very likely to not be a significant problem, however we need the tests to pass. ;-)
It looks like this is a problem only with the Python 2.6 builds, so any solution should use 'if sys.version_info < (2, 7):' so the 'solution' doesnt affect more modern python versions which dont need fixing.
There are three possible options that I can see quickly, which may or may not work:
1. call urllib3.disable_warnings() somewhere to prevent this warning 2. try to fix the security problem described by this warning, e.g. by installing root certificates - https://urllib3.readthedocs.org/en/latest/security.html#certifi-with-urllib3 3. silence this specific warning only. I believe it is being captured by the logging layer, and is being routed through pywikibot/userinterfaces/terminal_interface_base.py TerminalHandler.emit , so you may be able to detect and suppress this warning in there.
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, jayvdb Cc: XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
XZise added a comment.
Well according to https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarn... it only affects versions below 2.7.9 and Travis is using 2.7.9 so only the 2.6 tests have that problem.
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, XZise Cc: XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
jayvdb added a comment.
In your setup.py, you require 'requests >=2, <3' , but pwb.py reports 'Python module requests >= 2.7.0 is required.'
Does requests pre 2.7 not include `__version__`?
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, jayvdb Cc: XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
VcamX added a comment.
@XZise I tried to run that test locally. It's under tests/edit_failure_tests.py. I'm using the same user-config.py as travis ci test. It showed that it skipped all 3 tests. That means pywikibot figure out I'm using a sysop account. It's confusing.
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX Cc: XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
VcamX added a comment.
@jayvdb The latest version passed the test https://travis-ci.org/VcamX/pywikibot-core/builds/63634821. With the help of @XZise, I also sent a patch https://gerrit.wikimedia.org/r/#/c/212776/ to improve test_protected of TestSaveFailure in tests/edit_failure_tests.py
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX Cc: XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
jayvdb added a comment.
The test results are looking good. Could you please put a patch up for review in Gerrit. There are a large group of the devs together at a Hackathon, who can review the patch.
The one area which isnt covered by tests is async_request . Either we need to create tests for that, or we need to manually verify that works correctly after this patch.
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, jayvdb Cc: XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
gerritbot added a subscriber: gerritbot. gerritbot added a comment.
Change 213977 had a related patch set uploaded (by VcamX): Switch from httplib2 to requests
https://gerrit.wikimedia.org/r/213977
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, gerritbot Cc: gerritbot, XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
gerritbot added a project: Patch-For-Review.
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, gerritbot Cc: gerritbot, XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
VcamX added a comment.
@jayvdb The patch is on Gerrit https://gerrit.wikimedia.org/r/#/c/213977/ now.
The `async_request` seems a little hard to test..
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX Cc: gerritbot, XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
jayvdb added a comment.
The patch needs an update to pass jenkins rules.
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, jayvdb Cc: gerritbot, XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
gerritbot added a comment.
Change 213977 merged by jenkins-bot: Switch from httplib2 to requests
https://gerrit.wikimedia.org/r/213977
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, gerritbot Cc: gerritbot, XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
jayvdb closed this task as "Resolved".
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, jayvdb Cc: gerritbot, XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
jayvdb closed blocking task T98439: Add support for using python-requests as "Resolved".
TASK DETAIL https://phabricator.wikimedia.org/T98671
EMAIL PREFERENCES https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: VcamX, jayvdb Cc: gerritbot, XZise, Ricordisamoa, Aklapper, jayvdb, pywikipedia-bugs
pywikipedia-bugs@lists.wikimedia.org