Skip to main content

명지대학교 학생 인증 및 정보 조회를 위한 Python 라이브러리

Project description

mju-univ-auth

명지대학교 통합 인증(SSO) 및 학생 정보 조회 Python 라이브러리

PyPI version Python

1. 목적

이 라이브러리는 명지대학교 학생들이 프로그래밍 방식으로 학교 시스템에 접근할 수 있도록 지원합니다.

주요 기능

  • SSO 로그인: 명지대학교 통합 로그인 시스템을 통한 인증
  • 학생카드 조회: 학번, 이름, 학과, 학적상태 등 기본 정보 조회
  • 학적변동내역 조회: 학적 변동 이력 조회
  • 다양한 서비스 지원: LMS, 포털, MSI, MyiCAP, 도서관 등

활용 사례

  • 개인 학사 관리 자동화
  • 학생 정보 기반 애플리케이션 개발
  • 학교 시스템 연동 봇 제작

2. 사용법

설치

pip install mju-univ-auth

기본 사용법

학생카드 정보 조회

from mju_univ_auth import StudentCard

# 학번과 비밀번호로 학생카드 정보 조회
student_card = StudentCard.fetch(
    user_id="학번",
    user_pw="비밀번호"
)

# 정보 확인
print(f"이름: {student_card.name_korean}")
print(f"학번: {student_card.student_id}")
print(f"학과: {student_card.department}")
print(f"학년: {student_card.grade}")
print(f"학적상태: {student_card.status}")

# 딕셔너리로 변환
data = student_card.to_dict()

학적변동내역 조회

from mju_univ_auth import StudentChangeLog

# 학적변동내역 조회
change_log = StudentChangeLog.fetch(
    user_id="학번",
    user_pw="비밀번호"
)

# 정보 확인
print(f"학번: {change_log.student_id}")
print(f"이름: {change_log.name}")
print(f"학적상태: {change_log.status}")
print(f"이수학기: {change_log.completed_semesters}")

# 딕셔너리로 변환
data = change_log.to_dict()

SSO 로그인 (저수준 API)

다양한 명지대학교 서비스에 직접 로그인할 수 있습니다.

from mju_univ_auth.sso import MJUSSOLogin

# SSO 로그인 객체 생성
sso = MJUSSOLogin(user_id="학번", user_pw="비밀번호")

# 서비스별 로그인 (session 객체 반환)
session = sso.login(service='msi')      # My iWeb
session = sso.login(service='lms')      # e-Class (LMS)
session = sso.login(service='portal')   # 통합정보시스템
session = sso.login(service='myicap')   # MyiCAP
session = sso.login(service='library')  # 도서관

# 반환된 session으로 추가 요청 가능
response = session.get("https://msi.mju.ac.kr/...")

예외 처리

from mju_univ_auth import (
    StudentCard,
    MyIWebError,
    InvalidCredentialsError,
    NetworkError,
    SessionExpiredError
)

try:
    student_card = StudentCard.fetch(user_id="학번", user_pw="비밀번호")
except InvalidCredentialsError:
    print("아이디 또는 비밀번호가 올바르지 않습니다.")
except NetworkError:
    print("네트워크 연결에 실패했습니다.")
except SessionExpiredError:
    print("세션이 만료되었습니다.")
except MyIWebError as e:
    print(f"오류 발생: {e}")

환경 변수 사용 (권장)

보안을 위해 환경 변수나 .env 파일을 사용하는 것을 권장합니다.

import os
from dotenv import load_dotenv
from mju_univ_auth import StudentCard

load_dotenv()

student_card = StudentCard.fetch(
    user_id=os.getenv('MJU_ID'),
    user_pw=os.getenv('MJU_PW')
)

.env 파일 예시:

MJU_ID=학번
MJU_PW=비밀번호

상세 로그 출력

디버깅을 위해 상세 로그를 활성화할 수 있습니다.

student_card = StudentCard.fetch(
    user_id="학번",
    user_pw="비밀번호",
    verbose=True  # 상세 로그 출력
)

3. 이종 언어를 위한 서버 요청

4. 기술적 설명


라이선스

이 프로젝트는 MIT 라이선스 하에 배포됩니다.

주의사항

  • 이 라이브러리는 비공식 라이브러리입니다.
  • 명지대학교 학생만 사용할 수 있습니다.
  • 개인 정보 보호를 위해 비밀번호를 코드에 직접 작성하지 마세요.
  • 과도한 요청은 서버에 부담을 줄 수 있으니 적절히 사용해주세요.

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

mju_univ_auth-0.2.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

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

mju_univ_auth-0.2.0-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file mju_univ_auth-0.2.0.tar.gz.

File metadata

  • Download URL: mju_univ_auth-0.2.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for mju_univ_auth-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3be842cf9f735cdfd626078336c65c2a1354c3834aa444b361b8eaa2a2347b43
MD5 134f039852b3da6f15dd0969977574d5
BLAKE2b-256 f897afd41ad964996df058f78abffa099fcd7fb577e99d49871d01c2869eac79

See more details on using hashes here.

File details

Details for the file mju_univ_auth-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mju_univ_auth-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for mju_univ_auth-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fdeb13f5660f222a07ae28b5f03f21e210c3f3107f768f33dd4e1e1bca12a94b
MD5 b19c6582d1cef4c083f20aebb088476f
BLAKE2b-256 7b742f31ab6e0c89dd745efa9dfdd34fef9f0b391fe808b89d2cadeb4a9246e4

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