-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2c2ffe8
Showing
44 changed files
with
6,168 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Sphinx build info version 1 | ||
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. | ||
config: 45d9aefbee8ab4b3184e5da7bde7a06b | ||
tags: 645f666f9bcd5a90fca523b33c5a78b7 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
pyjiit.codelif.in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
API Reference | ||
============= | ||
|
||
.. autoclass:: pyjiit.wrapper.Webportal | ||
:members: | ||
|
||
.. autoclass:: pyjiit.wrapper.WebportalSession | ||
:members: | ||
|
||
.. automodule:: pyjiit.token | ||
:members: | ||
|
||
.. automodule:: pyjiit.attendance | ||
:members: | ||
|
||
.. automodule:: pyjiit.exam | ||
:members: | ||
|
||
.. automodule:: pyjiit.registration | ||
:members: | ||
|
||
.. automodule:: pyjiit.exceptions | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Design | ||
====== | ||
|
||
This page is still work in progress. Please move on to the next section. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.. pyjiit documentation master file, created by | ||
sphinx-quickstart on Thu Sep 19 20:09:29 2024. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
Welcome to pyjiit's documentation | ||
================================= | ||
|
||
**pyjiit** is a Python library for JIIT Webportal APIs. It provides methods to login, access attendance, results, registration data, etc. | ||
|
||
|
||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents: | ||
|
||
introduction | ||
design | ||
usage | ||
apiref |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
Introduction | ||
============ | ||
|
||
**pyjiit** is a Python library for accessing data from JIIT Webportal. It uses the internal APIs of JIIT Webportal to programattically access the data. It can be used in various types of projects which require getting attendance data or general student information (like results, registration, etc). | ||
|
||
.. note:: | ||
|
||
The data provided by the APIs is only as correct as provided on https://webportal.jiit.ac.in:6011/studentportal/ | ||
|
||
|
||
Features | ||
-------- | ||
|
||
* Login and Session management (with invalidation) | ||
* Attendance data queries | ||
* Subject registration data | ||
* Exam event data | ||
* Explicit exceptions | ||
* Happiness | ||
|
||
Roadmap | ||
------- | ||
|
||
* :code:`Webportal` instantiation with :code:`WebportalSession` (for cached sessions) | ||
* Cover more endpoints | ||
* Drink water | ||
* Sleep more than 2 hours in a day | ||
* Meetup with the people who designed JIIT Webportal | ||
* Heavily judge their design choices | ||
|
||
|
||
Dependencies | ||
------------ | ||
|
||
* requests | ||
* pycryptodome (this is explicit for very interesting reasons) | ||
* NESCAFE | ||
* `Dopamine Dose`_ | ||
|
||
.. _Dopamine Dose: https://open.spotify.com/playlist/3MD5jRlnXlLrMacF9rirOv?si=pH4WlKBPRyaJUokQwoehnA | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
Usage | ||
===== | ||
|
||
This section covers general usage of the API. | ||
|
||
Installing | ||
---------- | ||
|
||
To get started, install the package using pip | ||
|
||
.. code-block:: Bash | ||
pip install pyjiit | ||
Instantiation | ||
------------- | ||
|
||
.. code-block:: Python | ||
from pyjiit import Webportal | ||
w = Webportal() | ||
print(w) | ||
# Output: | ||
# Driver Class for JIIT Webportal | ||
pretty self-explanatory ig | ||
|
||
Logging in | ||
---------- | ||
|
||
.. code-block:: Python | ||
from pyjiit import Webportal | ||
from pyjiit.default import CAPTCHA | ||
w = Webportal() | ||
s = w.student_login("username", "password", CAPTCHA) | ||
print(w.session.clientid) | ||
# Output: | ||
# JAYPEE | ||
This calls the :code:`student_login` method with username, password and CAPTCHA | ||
|
||
The login method needs the Captcha object as well to defend against bots. | ||
But in practice, the captcha is not really tied to any state with your IP, so you can send any prefilled captcha and woohoo!! | ||
|
||
So there is a premade CAPTCHA object in :code:`pyjiit.default`, which can be used while logging in | ||
|
||
|
||
Changing the password | ||
--------------------- | ||
|
||
.. code-block:: Python | ||
from pyjiit import Webportal | ||
from pyjiit.default import CAPTCHA | ||
w = Webportal() | ||
w.student_login("username", "password", CAPTCHA) | ||
w.set_password("password", "password_strong") | ||
As usual we login and use the required method | ||
|
||
|
||
Getting the attendance | ||
---------------------- | ||
|
||
.. code-block:: Python | ||
# instantiate w = Webportal() and login before this | ||
meta = w.get_attendance_meta() | ||
header = meta.latest_header() | ||
sem = meta.latest_semester() | ||
print(w.get_attendance(header, sem)) | ||
# Output: | ||
# {'currentSem': '1', | ||
# 'studentattendancelist': [{'LTpercantage': 83.3, | ||
# 'Lpercentage': 92.9, | ||
# 'Lprepercentage': 0.0, | ||
# 'Lpretotalclass': 0.0, | ||
# 'Lpretotalpres': 0.0, | ||
# 'Lsubjectcomponentcode': 'L', | ||
# 'Lsubjectcomponentid': 'JISCP19050000001', | ||
# ... | ||
# ... | ||
# ... many rows | ||
# } | ||
You first get the metadata for the attendance which contains headers (courseid, etc) and semesters. | ||
:code:`get_attendance_meta()` returns an instance of :code:`AttendanceMeta` object which contains a list of available headers and semester. | ||
|
||
The methods :code:`latest_header()` and :code:`latest_semester()` are self-explanatory. | ||
|
||
You can choose any other header and semester from the lists :code:`AttendanceMeta.headers` and :code:`AttendanceMeta.semesters`. | ||
|
||
.. note:: | ||
|
||
Please note that the call to :code:`get_attendance` may take over 10 seconds to complete. This wait is from the server so nothing we can do, sadly ;( | ||
|
||
|
||
|
||
Getting Subject detail | ||
---------------------- | ||
|
||
.. code-block:: Python | ||
# instantiate w = Webportal() and login before this | ||
semesters = w.get_registered_semesters() | ||
sem = semesters[0] # get latest sem | ||
reg = w.get_registered_subjects_and_faculties(sem) | ||
print(*reg.subjects, sep="\n") | ||
# Output: | ||
# RegisteredSubject(employee_name='Teacher name', employee_code='SomeCode', minor_subject='N', remarks='REG', stytype='REG', credits=4.0, subject_code='15B11CI111', subject_component_code='T', subject_desc='SOFTWARE DEVELOPMENT FUNDAMENTALS-1', subject_id='150046', audtsubject='N') | ||
# ... | ||
# ... more rows | ||
print(reg.total_credits) | ||
# Output: | ||
22.5 | ||
We first get semester list and call the method with semester of choice. | ||
|
||
The method :code:`get_registered_subjects_and_faculties` returns an instance of :code:`Registrations` class. | ||
|
||
Exception Handling | ||
------------------ | ||
|
||
There several exceptions that might be raised during the use of the API. One such exception is :code:`NotLoggedIn`, which is raised when you try to call a method on :code:`Webportal`, which needs authorization (student_login). Like calling :code:`get_student_bank_info` before :code:`student_login` is first called. | ||
|
||
|
||
There are many more uses of the API, refer to next section for full API reference. |
Oops, something went wrong.