From 3c73736d2e35b9be0c07b679b61c53155bf0e416 Mon Sep 17 00:00:00 2001 From: bootleglibrary Date: Wed, 3 Jun 2020 11:32:17 +0200 Subject: [PATCH] pull from wiki script --- README.md | 4 ++++ scripts/pulltasks.py | 40 ++++++++++++++++++++++++++++++++++++++++ scripts/pulltasks.py~ | 24 ++++++++++++++++++++++++ scripts/tasks.html | 0 4 files changed, 68 insertions(+) create mode 100644 scripts/pulltasks.py create mode 100644 scripts/pulltasks.py~ create mode 100644 scripts/tasks.html diff --git a/README.md b/README.md index c3c3665..24e5b1c 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,7 @@ cd /var/www/html source venv/bin/activate +## Pulling the tasks + + python scripts/pulltasks.py > tasks.html + diff --git a/scripts/pulltasks.py b/scripts/pulltasks.py new file mode 100644 index 0000000..4b14aa6 --- /dev/null +++ b/scripts/pulltasks.py @@ -0,0 +1,40 @@ +import argparse +from mwclient import Site + +NS_CATEGORY = 14 + +p = argparse.ArgumentParser(description="Dump wiki files to html") +p.add_argument("--host", metavar='', default="pzwiki.wdka.nl", help='wiki host') +p.add_argument("--path", metavar='', default="/mw-mediadesign/", help="Wiki path. Should end with /") +p.add_argument("--output", default="../", help="Output path for pages") + +args = p.parse_args() +print(args) +# site and login + +print (""" + + + + + Tasks of the Contingent Librarian + + + + +""") + +site = Site(host=args.host, path=args.path) +tasks=site.Categories['Tasks of the Contingent Librarian'] +for card in tasks.members(): + print ("
") + print ("

{}

".format(card.page_title)) + print () + # print (card.text()) + htmlsrc = site.parse(page=card.name)['text']['*'] + print ("""
{}
""".format(htmlsrc)) + +print (""" + +""") + diff --git a/scripts/pulltasks.py~ b/scripts/pulltasks.py~ new file mode 100644 index 0000000..6f3aa62 --- /dev/null +++ b/scripts/pulltasks.py~ @@ -0,0 +1,24 @@ +import argparse +from mwclient import Site + +NS_CATEGORY = 14 + +p = argparse.ArgumentParser(description="Dump wiki files to html") +p.add_argument("--host", metavar='', default="pzwiki.wdka.nl", help='wiki host') +p.add_argument("--path", metavar='', default="/mw-mediadesign/", help="Wiki path. Should end with /") +p.add_argument("--output", default="../", help="Output path for pages") + +args = p.parse_args() +print(args) +# site and login + +site = Site(host=args.host, path=args.path) +tasks=site.Categories['Tasks of the Contingent Librarian'] +for card in tasks.members(): + print ("
") + print ("

{}

".format(card.page_title)) + print () + # print (card.text()) + htmlsrc = site.parse(page=card.name)['text']['*'] + print ("""
{}
""".format(htmlsrc)) + diff --git a/scripts/tasks.html b/scripts/tasks.html new file mode 100644 index 0000000..e69de29