Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P3242
thanks.py v2.0
Active
Public
Actions
Authored by
darthbhyrava
on Jun 14 2016, 3:41 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
Pywikibot-Thanks
Referenced Files
F4165177: thanks.py v2.0
Jun 14 2016, 3:41 PM
2016-06-14 15:41:49 (UTC+0)
Subscribers
None
#!/usr/bin/python
# -*- 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 pwb.py thanks [rev]
@params;
-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
()
site
.
login
()
#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
thank_rev
(
rev_id
)
if
__name__
==
"__main__"
:
main
()
Event Timeline
darthbhyrava
created this paste.
Jun 14 2016, 3:41 PM
2016-06-14 15:41:49 (UTC+0)
darthbhyrava
mentioned this in
T137462: GSoC: Pywikibot-Thanks | Meeting 5 | 10th June
.
Jun 14 2016, 3:46 PM
2016-06-14 15:46:03 (UTC+0)
darthbhyrava
updated the paste's language from
autodetect
to
python
.
darthbhyrava
mentioned this in
T137836: GSoC: Pywikibot-Thanks | Meeting 6 | 15th June
.
Jun 14 2016, 6:22 PM
2016-06-14 18:22:09 (UTC+0)
Log In to Comment