Skip to content

metakgp/twerp

 
 

Repository files navigation

twerp

Tethering Wiki to ERP

It uses the hercules API to update the 'Metakgp' wiki pages every semester for all the relevant pages with all the possible details. It is aimed at being the one bot that needs to run once a semester for updating all the relevant info, including calling blackjack (bot for grades update) and performing the duties of kakashi bots

Inspiration

Rajat is a twerp. He complains about the wiki not being updated frequently and is not willing to edit the pages by himself..... Presenting to you twerp - The complete remedy for twerp. Let the bot handle it.

Abilities

As of now it can

  • Add the timetable for the courses being offered by IITKGP in a semester to the corresponding page on metakgp wiki. Example

  • Update the time-table of existing prof pages.

  • Updates the course pages with the data obtained from the google form.

To-Dos

  • Update the pages on professors with the following features (The script written will be running on per semester basis ):

    • Time Table of non-existing prof pages by creating the page first and adding to it.
    • Append to his profile, the list of courses that he taught in a semester.
  • Call (a modified) Blackjack script to update the grades.

Using twerp

  • Running using pipenv:
        Clone and change your directory to this repo and run pipenv install:
            This will install the requirements and will create a virtual environment

        Run pipenv shell:
            This will activate the virtualenv

  • Running using pip:
        Clone and change your directory to this repo and run pip install -r requirements.txt

  • Run the setup.py file if you have downloaded first time or want to add a new wiki or modify an old wiki configurations:
        python3 setup.py

  • It will first clone pywikibot repo in folder named wiki_files in your current directory

  • It will ask for the link of the wiki and with which you want to save it:     For metakgp write:
            link = https://wiki.metakgp.org/w/Main_Page
            name = metakgp         family = 5 (it'll be mediawiki)

  • It will then generate user files (set username as Twerp) and don't set any bot password yet, it will ask during runtime

  • Run the bot :
        python3 twerp.py

For updating data from form under Course Archiving Drive

We are collecting information from masses to update courses on metakgp wiki in this form. Below is the process on how to update from the sheet to the wiki using twerp.

  • First enable the Google Sheets API, check here for its doc.
  • Obtain the credentials.json file from the Google API Console.
  • Create a new sheet which is a copy of the response sheet and delete the entries till we have already updated (mentioned below).
  • See about the sheetID of the new Google Spreadsheet and basic usage of Google Sheet API here
  • It will ask for the sheetID during runtime, make sure you should have the credentials.json file in the same folder as twerp.py
  • If the script stops in between, please remove entries till the row that have been updated during this runtime otherwise duplicate entries will be created.

Once the update is done, manually verify if the update was successful and make edits if any necessary.

NOTE: Updated till row number 29

Contribution

Join the slack channel : metakgp.slack.com