Page MenuHomePhabricator
Paste P3242 v2.0

Authored by darthbhyrava on Jun 14 2016, 3:41 PM.
# -*- coding: utf-8 -*-
A script which takes a revision ID on the test wiki and thanks it on behalf of the user logged in.
Syntax: python thanks [rev]
-rev: - The value of the revisionID to be thanked.
from __future__ import absolute_import, unicode_literals
import pywikibot
def thank_rev(rev_id):
Thank the given revision ID on the wiki on behalf of the user logged in.
#Login into the wiki
site = pywikibot.Site()
#Make Thank API call to site, and print result
result = site.thank_revision(rev_id)
print result
def main(*args):
Proces command line arguments and thank the rev
# Process the args
local_args = pywikibot.handle_args(args)
for arg in local_args:
option, sep, value = arg.partition(':')
if option == '-rev':
rev_id = int(value)
#Call the thank method
if __name__ == "__main__":