Page MenuHomePhabricator

GSoC: Pywikibot-Thanks | Meeting 5 | 10th June
Closed, ResolvedPublic

Description

| Friday, 10th June 2016 - 15:30 UTC (Note: Shifted to Sunday, 12th June, same time)
| jayvdb, darthbhyrava

Skype
Description: Third weekly project meeting.
Start: 15.30 UTC
End: 16.30 UTC


Agenda:
  • Review prototypes for
    • the test scripts/thanks.py script here.
    • the testing script for the above tests/thanks_tests.py here.
  • Discuss plan for next week:
    • How to remove the requests/urllib2 approach, and use site.py to make the API calls.
    • Adding User.thanks_enabled property for Subtask 1.
    • Assessing the Special:Log/thanks approach for thanks_tests. (How do I test when logging is disabled?)
    • Plan for Subtask 2 - T135411 (Where does the Flow code go?)
  • Review other tasks defined in minutes of T136892: GSoC: Pywikibot-Thanks | Meeting 4 | 3rd June
  • Brief review of MVP requirements.

Minutes of the Meeting

.

Prototype Review: thanks.py

Looking at the thank code in P3232, and fixing it.

  • Workflow is as follows: login, get token using Token API, then use urlib2/requests to make a POST request for the Thanks API call.
  • Issue: The current code throws a badtoken error, despite having a token which works on APISandbox.
  • Unsuccessful Attempts to fix the issue:
    • Escape the +\ at the end of the token string, as suggested here and as suggested by @polybuildr
    • Shift from using a urllib2 approach to a requests approach, as suggested by @AbdealiJK
  • Issue Fixed by jayvdb: Different sessions for token call and thank call, hence badtoken. To keep the same session alive, from pywikibot.comms.http import session.
  • Successful proof of concept P3234 which thanked this edit.
Prototype Review: thanks_tests.py

Reviewing the unittests. The plan is to make an edit to test.wikipedia, thank it using the thanks.py script, and then check with unit_tests if the thank action worked.

  • Change Line 21 from code = en to code = test since we we will be using test.wikipedia.
  • Remove the dry param. We want to make an actual edit to test, not simulate one.
  • Editing test: Get add_text to write to test, and get corresponding rev_id.
  • Thanking the edit: Get thanks to thank the edit based on the rev_id.
  • Checking thanks: Extract the Special:Log/thanks page before and after the thanks, and compare. If there is a new entry from logged in user, thanks was successful.
  • Add a note to the test suite indicating that this process relies on two features which may be considered bugs:
    • The fact that you can thank yourself.
    • The fact that even if thanks notifs are disabled for the recipient, it'll still show up on the log, since logging is a server related activity.
User.thanks_enabled property.
  • Core question to answer: How can the MediaWiki API determine whether or not a user has thanks notifications enabled? Investigate.
  • One approach: extract the thanked_user from the log, and then extract the thanks_enabled property and check. This may work, it is not a very good approach, though.
  • New user, just joined wiki, how do you check if thanks is enabled? Is the preference for thanks of the user exposed via the MediaWiki API? If it is, how do we access it? If it isn't exposed, then it is not possible for us to account for it in pywikibot, either.
  • Since a lot of these functionalities are used by JS for user-interface, it probably is exposed. Investigate. If it's possible, then create a prototype which can extract this preference.
  • The above will not affect testing accuracy, it is possible to test without knowing the preference, however for the thanks script, we must find out.
  • To get the log, use logevents() in site.py, with the correct logtype.
Community Participation

Yet another reminder by @jayvdb, urging me to ask for help beyond #pywikibot and #mediawiki IRC channels.

Plan for adding support for Flow.
  • We'll discuss this in the next meeting on Wednesday. Make a quick plan for thanks flow.
  • A small session on Tuesday to take a look at the thanks related code.

Before Next Meet:
  • Ask for help on more channels.
    • @Legoktm helped me out with User Preferences queries on #wikimedia-tech
  • Use the pywikibot API workflow in site.py, instead of session.post(), to make the API calls for thanks.py
    • Here's the code for thanks.py: P3242
    • Here's the code added to class APISite in site.py: P3243
  • Make the following changes to thanks_tests.py:
    • Change code and dry values.
    • Write to a test page using add_text.py
    • Use thanks.py to thank the above edit.
    • Get log entry before and after the above using site.logevents() for comparision.
    • Add notes as mentioned in the minutes.
  • Investigate into MediaWiki API access for thanks preferences for a User.
    • Investigated. Now add User.thanks_enabled property only for anonymous users.
  • @jayvdb to decide a time for meeting on Wednesday.

Event Timeline

@jayvdb, @Legoktm something has come up for Friday, 15.30 UTC. Is it possible to postpone this meet to Saturday or Sunday at the same time?

Danny_B renamed this task from GSoC: Pywikibot-Thanks | Meeting, 10th June to Meeting, 10th June.Jun 10 2016, 12:10 AM
Legoktm renamed this task from Meeting, 10th June to GSoC: Pywikibot-Thanks | Meeting, 10th June.Jun 10 2016, 12:15 AM
Legoktm added a subscriber: Danny_B.

@darthbhyrava Sunday should work for me.

@Danny_B please do not remove useful important information from task titles, thanks.

@Danny_B please do not remove useful important information from task titles, thanks.

You have tags for that and both are used here. No need to duplicate the info and clutter the search results.

Please consider using events instead of tasks to manage meetings.
I've created E208: GSoC 2016 - Pywikibot-Thanks weekly meeting as a substitution to this task for you as a demo.

Thanks @Legoktm. :)
Waiting for @jayvdb to confirm or state his preference.

@Danny_B - we did consider events, but tasks are easier to handle on project workboards, and it is not possible to create subtasks or parent tasks for an event, or to assign it to the mentors. Hence minutes of the meeting are being hosted on tasks.

Sunday is ok for me also. Please send a single event Google Calendar invite for the new meeting time so it appears in my diary.

Also, please send an email to myself and legoktm explaining privately what has come up requiring that the meeting is moved.

Also, please send an email to myself and legoktm explaining privately what has come up requiring that the meeting is moved.

Thanks for pushing the meeting to Sunday. I have sent you the invite, and the email.

While your script is calling APISite.login , the login information is not being used in the thanks API call, because you start a new requests session.
If you look at all of the other methods in site.py class APISite they use the pywikibot.data.api classes, and which uses pywikibot.comms.http , which reuse the same session to keep using the login information.

So the quick fix is the change import requests to from pywikibot.comms.http import session, and then change requests.post to session.post

darthbhyrava renamed this task from GSoC: Pywikibot-Thanks | Meeting, 10th June to GSoC: Pywikibot-Thanks | Meeting 5 | 10th June.Jun 13 2016, 6:26 PM
darthbhyrava updated the task description. (Show Details)
darthbhyrava added a subscriber: AbdealiJK.
darthbhyrava removed a subscriber: AbdealiJK.