Manual:Pywikibot/Flow

Pywikibot includes basic support for Flow, the new discussion framework for Wikimedia wikis. This support will evolve over time as more features are added.

ExamplesEdit

Determining if a page is a Flow boardEdit

import pwb  # only needed if you haven't installed the framework as side-package
import pywikibot
import pywikibot.flow
site = pywikibot.Site('mediawiki', 'mediawiki')
page = pywikibot.Page(site, 'Talk:Sandbox')
if page.is_flow_page():
    board = pywikibot.flow.Board(page)

Loading topic titlesEdit

import pwb  # only needed if you haven't installed the framework as side-package
import pywikibot
import pywikibot.flow
site = pywikibot.Site('mediawiki', 'mediawiki')
board = pywikibot.flow.Board(site, 'Talk:Sandbox')
topic_titles = []
for topic in board.topics():
    topic_titles.append(topic.root.get())

Creating new topicsEdit

import pwb  # only needed if you haven't installed the framework as side-package
import pywikibot
import pywikibot.flow
site = pywikibot.Site('mediawiki', 'mediawiki')
board = pywikibot.flow.Board(site, 'Talk:Sandbox')
title = 'New topic'
content = 'This is a new topic.'
topic = board.new_topic(title, content)

Replying to topicsEdit

import pwb  # only needed if you haven't installed the framework as side-package
import pywikibot
import pywikibot.flow
site = pywikibot.Site('mediawiki', 'mediawiki')
board = pywikibot.flow.Topic(site, 'Topic:whatever')
content = 'This is a new reply.'
reply = topic.reply(content)


If you need more help on setting up your Pywikibot visit the #pywikibot IRC channel connect or pywikibot@ mailing list.