Halfak added a comment.
I think that our biggest concern will be signing new requests with the AccessToken. requests-oauthlib/requests provides native support for this. I don't see how we can do that easily with httplib2.
It seems that the base oauthlib would be our best bet for getting onto the platform that is post popular and well documented. See https://oauthlib.readthedocs.org/en/latest/ requests-oauthlib is built on top of that. Also note that MediaWiki supports OAuth 1.0, so that oauth2client lib won't work for us.
If we do go the route of implementing our own request signing strategy with oauthlib, we'll probably want to start something like httplib2-oauthlib. I suspect this will be hard to do (maybe more difficult than writing out the httplib2 bits) and need some help from someone like @csteipp to get it reviewed.
TASK DETAIL
https://phabricator.wikimedia.org/T74065
REPLY HANDLER ACTIONS
Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: Halfak
Cc: Evanontario, Sitic, Qgil, Ricordisamoa, Nemo_bis, Halfak, Krinkle, jayvdb, valhallasw, MZMcBride, csteipp, scfc, coren, pywikipedia-bugs
XZise created this task.
XZise added a subscriber: XZise.
XZise added projects: pywikibot-core, Pywikibot-tests.
Restricted Application added subscribers: Aklapper, pywikipedia-bugs.
TASK DESCRIPTION
When doing `python -m unittest tests.pagegenerators_tests.TestFactoryGeneratorWikibase` or `python -m unittest tests.pagegenerators_tests.TestFactoryGenerator` in Python 3.4.2 I got:
sys:1: ResourceWarning: unclosed <ssl.SSLSocket fd=5, family=AddressFamily.AF_INET6, type=2049, proto=6, laddr=('…', 43038, 0, 0), raddr=('2620:0:862:ed1a::1', 443, 0, 0)>
sys:1: ResourceWarning: unclosed <socket.socket fd=4, family=AddressFamily.AF_INET6, type=2049, proto=6, laddr=('…', 52315, 0, 0), raddr=('2620:0:862:ed1a::1', 80, 0, 0)>
But I don't get the result every time so maybe it's also happening in other tests or is a more general “problem”. Although I haven't seen it when I do `python setup.py test` so maybe that is doing the clean up properly?
TASK DETAIL
https://phabricator.wikimedia.org/T89116
REPLY HANDLER ACTIONS
Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: XZise
Cc: pywikipedia-bugs, Aklapper, XZise, jayvdb
jayvdb added a comment.
@Halfak, re httplib2 , it doesnt have native support for oauth, but there are full-blown libraries around ( https://github.com/google/oauth2client/tree/master/oauth2client ), and also simple clients we could use as a template for a custom implementation (e.g.
https://github.com/tswicegood/httplib2-oauth/blob/master/oauthclient/base.py ).
Given your involvement, I think it would be wise to try to use requests-oauthlib . I've tested it in py2.6 and provided a patch for one of its dependency bugs. https://github.com/requests/requests-oauthlib/pull/167
If we use requests-oauthlib, could we isolate the use of requests to only the Oauth negotiation, and copy the credentials from the requests session into a httplib2 session?
Then only the login phase needs to use requests, and then httplib2 would be used for the rest of the workload. That would be simpler than a complete switch to requests.
TASK DETAIL
https://phabricator.wikimedia.org/T74065
REPLY HANDLER ACTIONS
Reply to comment or attach files, or !close, !claim, !unsubscribe or !assign <username>.
EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/
To: jayvdb
Cc: Evanontario, Sitic, Qgil, Ricordisamoa, Nemo_bis, Halfak, Krinkle, jayvdb, valhallasw, MZMcBride, csteipp, scfc, coren, pywikipedia-bugs