Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.
/ pymyku Public archive

An unofficial my.ku.th API wrapper and utilities for python.

License

Notifications You must be signed in to change notification settings

lazykern/pymyku

Repository files navigation

pymyku

THIS REPOSITORY IS UNMAINTAINED

PyMyKU

Language: Python Request

An unofficial MyKU API wrapper and utilities for python.

Table of Contents

Notices

This project was developed by a KU student and is not affiliated with the university. Please respect the API when using this project.

Documentation

All documentation is available here.

You can also use help() to see the docstrings of any modules in pymyku.

Examples

You can find some examples in the examples.

Installation

Prerequisites

From PyPI

python -m pip install pymyku

From source

git clone https://github.com/lazykern/pymyku.git
cd pymyku
python -m pip install -r requirements.txt
python -m pip install -e .

Usage

You can use this library by importing the pymyku module to your script.

Methods

Assume that USERNAME is the username of your Nontri account and PASSWORD is the password of your Nontri account.

Client

import pymyku

ku_client = pymyku.Client('USERNAME', 'PASSWORD')

response = ku_client.fetch_gpax()

print(response)

Requests

from pymyku import requests, TokenAttr
from pymyku.utils import extract

login_res = requests.login('USERNAME', 'PASSWORD')

access_token = extract(login_res, TokenAttr.ACCESS_TOKEN)

response = requests.get_gpax(access_token).json()

print(response)

Output

{
    'code': 'success',
    'results': [
            {
                'std_id': '######',
                'std_code': '##########',
                'gpax': #.##,
                'total_credit': ##
            }
    ]
}

Notes

The only goal of this project is to make it simpler to send API requests to MyKU. There's no need to be concerned about the user's personal data being saved or shared.

References