You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3.4 KiB
3.4 KiB
In [12]:
import mwclient site = mwclient.Site('pzwiki.wdka.nl', path='/mw-mediadesign/') site.login( username='user', password='pass' ) page = site.pages['Diffractive Cookbook'] text = page.text() text += 'A new edit' page.edit(text, 'A new little test')
Out[12]:
OrderedDict([('result', 'Success'), ('pageid', 38082), ('title', 'Test with the Diffbot'), ('contentmodel', 'wikitext'), ('oldrevid', 218752), ('newrevid', 218753), ('newtimestamp', '2022-05-31T10:39:36Z')])
In [14]:
def wiki_recipe(recipe): steps = '' for log in recipe['logs']: steps+= f'# {log}\n' # PROV TEMPLATE content = f""" === {recipe['title']} === ''{recipe['description']}'' <br> '''Nature of the input''' <br> {recipe['nature']} <br> ''' Process Log''' <br> {steps} '''Who''' <br> {recipe['who']} """ return content
In [19]:
r = { "title": "Test test test", "description": "A super simple description", "logs": ["first step", "second step", "third step"], "who": "a friend of mine", "nature": 'methods' } print(wiki_recipe(r))
=== Test test test === ''A super simple description'' <br> '''Nature of the input''' <br> methods <br> ''' Process Log''' <br> # first step # second step # third step '''Who''' <br> a friend of mine
In [ ]: