Skip to main content
codecov CircleCI PyPI version

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.

Installation

$ pip install citi-wikibot

Usage

Note: Keep in mind that every command will overwrite the current page content with the one you provide.

Quickstart

  1. Just initialize your Wikibot

  2. Use one of the commands, it’s that simple :sparkles:

Editing a page directly from the shell

$ python
>>> from wikibot import Wikibot
>>> bot = Wikibot('username', 'password', 'page_title')
>>> bot.edit_page('== My title ==\nHello world!')

Editing a page from a Markdown file

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')

Gets the Homepage from GitHub wiki of your repository

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

Reference

edit_page(content)

  • 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!')

edit_page_from_file(file)

  • 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')

edit_page_from_github(repo)

  • 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')

Metadata

Release files for citi-wikibot 0.4.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for citi-wikibot 0.4.14
File Size Uploaded
citi-wikibot-0.4.14.tar.gz 4.3 kB Details

Release files / citi-wikibot-0.4.14.tar.gz

Download URL citi-wikibot-0.4.14.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
33b191a4de831b04100250c39e70caa63e79d4233cda3ab8fd701110bc1d684e
BLAKE2b-256 checksum
How to use checksums
a75bdea457daabf0ad78fd4feecc73858dc826911070a1102134b17cc8f8ace3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.4.14 This release

1 release file

0.4.13

1 release file

0.4.12

1 release file

0.4.11

1 release file

0.4.10

1 release file

0.4.9

1 release file

0.4.8

1 release file

0.4.7

1 release file

0.4.6

1 release file

0.4.5

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.2

1 release file

0.4.1

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page