#!/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()