Python script to easily edit pages on CITi's Wiki directly from shell or using a Markdown (.md) file. Currently, our Wiki is made using MediaWiki.
$ pip install citi-wikibot
Note: Keep in mind that every command will overwrite the current page content with the one you provide.
- Just initialize your Wikibot
- Use one of the commands, it's that simple โจ
$ python
>>> from wikibot import Wikibot
>>> bot = Wikibot('username', 'password', 'page_title')
>>> bot.edit_page('== My title ==\nHello world!')
Important: It's recommended that you run the script in the folder your file is located
$ ls
notes.md
$ python
>>> from wikibot import Wikibot
>>> bot = Wikibot('username', 'password', 'page_title')
>>> bot.edit_page_from_file('notes.md')
Automatically gets your GitHub wiki homepage (example), parses it and edits the page on CITi Wiki (result).
You must declare your personal access token from GitHub in a variable called GITHUB_TOKEN
in order to use this command.
$ GITHUB_TOKEN="mypersonalaccesstoken123"
$ python
>>> from wikibot import Wikibot
>>> bot = Wikibot('username', 'password', 'page_title')
>>> bot.edit_page_from_github('my_repository')
GitHub's wiki homepage from my_repository successfully loaded and edited!
Check it here: http://wiki.citi.org.br/index.php?title=insert_page
-
content
(string): The content you want to put in the page. Note that it will overwrite the current one! It accepts Wikicode (Wikipedia and MediaWiki format).Example:
from wikibot import Wikibot bot = Wikibot('myusername', '123', 'My_Page') bot.edit_page('*Hello* world!')
-
file
(string): The file name you want to load. It must be in Markdown format!Example:
from wikibot import Wikibot bot = Wikibot('myusername', '123', 'My_Page') bot.edit_page_from_file('notes.md')
-
repo
(string): The name of your repository. It needs to have a Wiki. The script will automatically search in citi-ufpe's organization.Remember to declare your
GITHUB_TOKEN
environment variable! Instructions above in Usage.Example:
from wikibot import Wikibot bot = Wikibot('myusername', '123', 'My_Page') bot.edit_page_from_github('my-repo')