Skip to main content

A robust web scraper and API wrapper for TIU student system

Project description

TIUPY

A Python library for interacting with Tishk International University's student portal. This library provides a comprehensive interface for accessing student information, course data, and personal details through TIU's web portal.

License: MIT Python 3.7+

Features

  • Authentication

    • Login with username/password
    • Session-based authentication (SID)
    • Secure logout functionality
  • Profile Information

    • Basic user details (name, department, etc.)
    • Academic information (GPA, grade, curriculum)
    • Personal information (contact details, registration data)
    • Profile image URL retrieval
  • Course Management

    • Course listings with detailed information
    • Grade information
    • Credit hours tracking
    • JSON export capabilities

Installation

Install the package using pip:

pip install tiupy

Or install from source:

git clone https://github.com/yourusername/tiupy.git
cd tiupy
pip install -e .

Quick Start

from tiupy import Tiu

# Initialize client
tiu = Tiu()

# Login
tiu.login("username", "password")

# Get profile information
print(f"Welcome, {tiu.profile.name}")
print(f"Department: {tiu.profile.department}")
print(f"GPA: {tiu.profile.gpa}")

# Get course data
courses = tiu.get_courses_data()
for course in courses.courses:
    print(f"{course.course_code}: {course.grade}")

# Cleanup
tiu.logout()

Detailed Usage

Authentication

from tiupy import Tiu

# Standard login
tiu = Tiu()
tiu.login("username", "password")

# Session ID login
tiu.sid_login("existing_session_id")

# Configure with proxy and custom timeout
tiu = Tiu(
    proxies={"http": "http://proxy.example.com:8080"},
    request_timeout=30
)

Profile Information

# Basic profile information
profile = tiu.profile
print(f"Name: {profile.name}")
print(f"Department: {profile.department}")
print(f"Student ID: {profile.student_id}")
print(f"GPA: {profile.gpa}")

# Detailed personal information
personal_info = tiu.get_personal_info()
print(f"Gender: {personal_info.gender}")
print(f"Status: {personal_info.status}")
print(f"Registration Date: {personal_info.registration_date}")

# Phone numbers
print("Student Phones:", personal_info.phones)
print("Father's Phone:", personal_info.father_phone)
print("Mother's Phone:", personal_info.mother_phone)

Course Data

# Get course information
courses = tiu.get_courses_data()

# Access as Python objects
for course in courses.courses:
    print(f"Course: {course.course_name}")
    print(f"Code: {course.course_code}")
    print(f"Credits: {course.credits}")
    print(f"Grade: {course.grade}")
    print("---")

# Export to JSON
json_data = courses.to_json()
print(json_data)

# Get as list of dictionaries
dict_list = courses.to_dict_list()

Error Handling

from tiupy import Tiu

try:
    tiu = Tiu()
    tiu.login("username", "password")
    profile = tiu.profile
except Exception as e:
    print(f"Error occurred: {e}")
finally:
    if tiu.sid:  # Check if login was successful
        tiu.logout()

Data Models

UserProfile

class UserProfile:
    image: str                # Profile image URL
    name: str                 # Full name
    curriculum: str           # Study curriculum
    department: str           # Department name
    student_id: str          # Student ID number
    grade: str               # Current grade
    email: str               # Email address
    mobile: str              # Mobile number
    gpa: str                 # Grade Point Average
    year: str                # Academic year
    term: str                # Current term
    personal_info: PersonalInfo  # Detailed personal information

PersonalInfo

class PersonalInfo:
    gender: str              # Student's gender
    status: str             # Academic status
    tuition_type: str       # Tuition/Scholarship status
    registration_date: str   # Registration date
    father_name: str        # Father's name
    mother_name: str        # Mother's name
    phones: List[str]       # List of phone numbers
    father_phone: str       # Father's phone number
    mother_phone: str       # Mother's phone number

Course

class Course:
    course_code: str        # Course code
    course_name: str        # Course name
    credits: str           # Credit hours
    grade: str            # Achieved grade

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Tishk International University for providing the student portal
  • Contributors who have helped improve this library

Disclaimer

This library is not officially associated with Tishk International University. Use it responsibly and in accordance with the university's terms of service and policies.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tiupy-1.1.2.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tiupy-1.1.2-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file tiupy-1.1.2.tar.gz.

File metadata

  • Download URL: tiupy-1.1.2.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for tiupy-1.1.2.tar.gz
Algorithm Hash digest
SHA256 8625f2f5413a25535442908ebd52f3b9cb527941f6145b6b19b3ecc8a1440358
MD5 17486b7b053f49e44fd446a1751eefec
BLAKE2b-256 93a0679bc4008f8598855fe3ec38edc0805fd20652bfb2911efdc6351dad3d59

See more details on using hashes here.

File details

Details for the file tiupy-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: tiupy-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.11

File hashes

Hashes for tiupy-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 940f5fe9174bddf86254e1079835c7b017482363285702292c0e0487191b9f75
MD5 2263685206b55e67900124636e163a68
BLAKE2b-256 9ce671073a04945b22db2fa3bbf4d9b9ebfc3c34cd6cfc605d5c112e037cfa02

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page