This is a Python script for interacting with the AMIZONE website using the requests
library. It provides a set of methods to perform various actions such as logging in, retrieving attendance information, accessing exam schedules, fetching faculty information, and retrieving results.
- Python 3.x
requests
librarybs4
(Beautiful Soup) librarytelegram
libraryfirebase
- Clone the repository or download the script file.
- Install the required libraries using pip:
pip install requests bs4 telegram
The Telegram bot requires Firebase integration to store and retrieve user credentials. Follow the steps below to set up Firebase integration:
-
Create a Firebase project: Go to the Firebase Console and create a new project.
-
Generate Firebase Admin SDK credentials: In the Firebase Console, go to "Project settings" and navigate to the "Service Accounts" tab. Click on "Generate new private key" to download the JSON key file.
-
Save the JSON key file: Save the downloaded JSON key file securely on your system.
-
Update the AMIZONE class: In the
__init__
method of theAMIZONE
class, update the path to the JSON key file in thecredentials.Certificate()
call.
cred = credentials.Certificate('/path/to/your/firebase-adminsdk-key.json')
- Initialize the Firebase Admin SDK: In the
__init__
method of theAMIZONE
class, update thedatabaseURL
parameter in thefirebase_admin.initialize_app()
call with your Firebase project's database URL.
firebase_admin.initialize_app(cred, {
'databaseURL': 'https://your-project-id.firebaseio.com/'
})
- Import the necessary classes and exceptions:
from http.client import HTTPException import requests import bs4 import json import telegram from telegram import Update, Bot, replymarkup from telegram.ext import Updater, CommandHandler, CallbackContext from requests.exceptions import HTTPError
- Create an instance of the
AMIZONE
class:amizone = AMIZONE()
- Login to AMIZONE using your credentials:
amizone.login(username, password)
- Perform the desired actions by calling the appropriate methods of the
AMIZONE
class. For example, to retrieve attendance information:attendance_data = amizone.my_courses()
- Handle exceptions appropriately to deal with any errors that may occur during the process.
login(username, password)
: Logs in to AMIZONE using the specified username and password.my_courses(sem=None)
: Retrieves the list of courses along with attendance information. Optionally, you can provide a semester to filter the results.faculty()
: Retrieves faculty information.exam_schedule()
: Retrieves the exam schedule.my_profile()
: Retrieves the user's profile information.results(sem=None)
: Retrieves the results. Optionally, you can provide a semester to filter the results.start_telegram_bot()
: Starts a Telegram bot for interacting with AMIZONE. This method uses thetelegram
library and requires a valid Telegram token.
Please note that some methods may raise exceptions in case of invalid or expired cookies, HTTP errors, or other issues. Make sure to handle these exceptions appropriately in your code.
This script was developed by Vaibhav Srivastava and is provided under the MIT License. Feel free to modify and use it according to your needs.