Coder Social home page Coder Social logo

citi-wikibot's Introduction

CITi's Wikibot

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 โœจ

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

citi-wikibot's People

Stargazers

 avatar

Watchers

 avatar  avatar

citi-wikibot's Issues

Handle GITHUB_TOKEN correctly

When you try to use a command that relies on GitHub api, it gives an ValueError error, saying that I need to declared a env var called GITHUB_TOKEN.

Add coverage label to CI

It's important to see how % of the project is covered by tests. Currently, CircleCI is not finding the right coverage report to upload to Codecov.

So far, this project doesn't have any tests, but the label on README should have "0%" instead of "unknown".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.