Skip to main content

🎓 Egrading API Wrapper

A lightweight Python wrapper for the ENSAM Egrading platform. It handles authentication, exam listing, exam data retrieval, and even automatic MCQ solving using ChatGPT.

Built for students who like their grades served with an API. 🚀


✨ Features

  • ✅ Secure login using ENSAM credentials
  • 📋 Fetch all available exams
  • 📄 Get detailed data for a specific exam
  • 🤖 Auto-solve MCQs using ChatGPT
  • 🧠 Supports single & multiple correct answers
  • 🍪 Automatic handling of access & refresh tokens
  • ⚡ Fast, lightweight, and hackable

📦 Installation

If you plan to publish it as a package:

pip install egrading-api

Or clone directly:

git clone https://github.com/NacreousDawn596/egrading-api.git
cd egrading-api
pip install -r requirements.txt

🛠 Requirements

pip install requests urllib3 g4f

🚀 Quick Start

from egrading_api import Student

# Initialize client
student = Student("email@ensam.ac.ma", "password")

✅ This automatically:

  • Logs you in
  • Stores accessToken
  • Stores refreshToken
  • Prepares the ChatGPT client

📋 List All Available Exams

exams = student.listExams()
print(exams)

🔍 Returns:

  • Exam IDs
  • Subjects
  • Status
  • Time windows
  • Metadata used to launch exams

📄 Get Full Exam Data

exam_id = "123456"
exam_data = student.getExamData(exam_id)

print(exam_data)

✅ Includes:

  • Questions
  • Choices
  • Exam duration
  • Scoring details
  • Exam configuration

🤖 Auto-Solve MCQs using ChatGPT

Once you extract the questions from the exam:

questions = exam_data["questions"]

answers = student.answerQuestionsUsingChatGPT(questions)
print(answers)

✅ Output Format

{
  "Q1": [2],
  "Q2": [1, 3],
  "Q3": [4]
}
  • 🟢 Always returns lists
  • 🟢 Supports multiple correct answers
  • 🟢 Indexes are 1-based

🧠 How the AI Solving Works

  • Questions are split into smart chunks

  • Each chunk is sent to ChatGPT

  • The model is forced to return:

    • ✅ A raw Python dictionary
    • ✅ No markdown
    • ✅ No explanations
  • Output is:

    • Parsed
    • Normalized
    • Merged into a clean final result

🔐 Authentication System

The wrapper handles:

  • ✅ Access token stored in headers
  • ✅ Refresh token stored in cookies
  • ✅ Automatic session reuse
  • ✅ No manual token handling needed

⚙️ Class Overview

Student(email, password, login=True)

Parameter Type Description
email str ENSAM email
password str Account password
login bool Auto-login on init

listExams() → dict

Returns all exams available to the student.


getExamData(exam_id: str) → dict

Returns full structured exam data.


answerQuestionsUsingChatGPT(questions: list, model="gpt-4") → dict

Auto-answers all MCQs using AI.


⚠️ Security Notes

  • ❗ This project disables SSL verification (verify=False)
  • ❗ Credentials are sent in plain requests
  • ✅ Use only for educational & personal testing
  • ✅ Never expose your password in public repos

🧪 Example Full Workflow

student = Student("email@ensam.ac.ma", "password")

exams = student.listExams()
first_exam_id = exams[0]["id"]

exam_data = student.getExamData(first_exam_id)

answers = student.answerQuestionsUsingChatGPT(exam_data["questions"])

print(answers)

🛑 Disclaimer

This project is:

  • ❌ Not affiliated with ENSAM
  • ❌ Not officially supported
  • ✅ Only for educational & research purposes

Use responsibly. Don’t speedrun your academic career into chaos 💀


❤️ Author

Made with caffeine, insomnia, and bad life choices by Kamal ☕ If this saved you during exam week == you owe me monster hhhhhhhh.


Metadata

Release files for egrading-api 0.1.0

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

Source distribution (sdist)

Source distribution for egrading-api 0.1.0
File Size Uploaded
egrading_api-0.1.0.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for egrading-api 0.1.0
File Interpreter ABI Platform
egrading_api-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.7 kB

Release files / egrading_api-0.1.0.tar.gz

Download URL egrading_api-0.1.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7c06b4d766d7f9ae1adf749eaba6190bef829418edef6b11806529ff77927ba4
BLAKE2b-256 checksum
How to use checksums
e96019a64a38370c87eea301a4a67e1593a871e00b8dba9fa04a863a66709057
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / egrading_api-0.1.0-py3-none-any.whl

Download URL egrading_api-0.1.0-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5e066d064115d7e6ff9a4f229a1e1b5ce7da2342c51ca6ae1f502fb981d21d3
BLAKE2b-256 checksum
How to use checksums
e070450b1e9bdaf6cb854924f92ae64f4edebb97416b9bc4d8e82a3dc31dd85a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

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