This project is a FastAPI-based web service for searching and retrieving student results based on their names and roll numbers. It includes functionality for extracting and processing data from a given URL and storing results temporarily in Redis.
-
Clone the repository:
git clone https://github.com/praveensaharan/rbse-results.git cd rbse-results
-
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up environment variables:
Create a
.env
file in the project root directory and add the following environment variable:REDIS_URL=redis://localhost:6379/0
-
Run the application:
uvicorn main:app --reload
After starting the FastAPI server, you can access the API documentation at http://127.0.0.1:8000/docs
.
- main.py: The entry point of the application.
- models.py: Contains Pydantic models.
- utils.py: Contains utility functions for parsing HTML and extracting data.
- redis_utils.py: Contains utility functions for interacting with Redis.
- results_utils.py: Contains functions for handling result retrieval.
- routers/search.py: Contains the search-related endpoints.
Initiates a background task to search for student results based on the provided name and URL.
-
Request Body:
{ "name": "student_name", "url": "results_page_url" }
-
Response:
{ "message": "Processing started", "uuid": "unique_identifier" }
Retrieves the results of the search task associated with the given UUID.
- Response:
{ "results": [...] }
Retrieves the HTML content for the student's results based on the provided roll number and class.
-
Query Parameters:
rollno
: The roll number of the student.student_class
: The class of the student (e.g.,10th
,12th-science
,12th-arts
,12th-commerce
).
-
Response:
{ "html_content": "..." }
- REDIS_URL: The URL for the Redis instance.
This project is licensed under the MIT License.