Page MenuHomePhabricator

scripts/flow_thanks.py - v1.0

Authored By
darthbhyrava
Jun 16 2016, 4:29 AM
Size
992 B
Referenced Files
None
Subscribers
None

scripts/flow_thanks.py - v1.0

#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
A script which takes a post ID on a Flow Board and thanks it on behalf of the
user logged in.
Syntax: python pwb.py thanks -flow_post:[post_id]
@params;
-flow_post: The value of the postID to be thanked.
"""
from __future__ import absolute_import, unicode_literals
import pywikibot
def thank_flow_post(post_id):
"""
Thank the given Post ID on a Flow Board on behalf of the user logged in.
"""
#Login into the side
site = pywikibot.Site()
site.login()
#Make Thank API call to site, and print result
result = site.thank_flowpost(post_id)
print result
def main(*args):
"""
Proces command line arguments and thank the post
"""
local_args = pywikibot.handle_args(args)
for arg in local_args:
option, sep, value = arg.partition(':')
if option == '-flow_post':
post_id = value
thank_flow_post(post_id)
if __name__ == "__main__":
main()

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3800310
Default Alt Text
scripts/flow_thanks.py - v1.0 (992 B)

Event Timeline