Comci.net 시간표 API 비공식 클라이언트
Project description
Comci.net 시간표 API 클라이언트
컴시간(comci.net) 비공식 API를 사용하여 학교 검색 및 시간표 조회를 할 수 있는 Python 모듈입니다.
설치
pip install -r requirements.txt
사용법
1. 학교 검색 (지역, 학교명, 학교코드)
from comci import search_schools
# "신송" 검색
schools = search_schools("신송")
for s in schools:
print(s["region"], s["school_name"], s["school_code"])
# 인천 신송중학교 49654
# 인천 신송고등학교 51825
2. 특정 학년/반 시간표 조회
from comci import get_timetable
# 1학년 1반 시간표 (정리.md 반환 구조)
timetable = get_timetable(49654, grade=1, class_num=1)
# {"월": [...], "화": [...], "수": [...], "목": [...], "금": [...]}
2-1. 주차 선택 (일자 드롭다운과 동일)
학생 시간표에서 URL이 ...MF8x(이번 주) → ...MF8y(다음 주)처럼 바뀌는 것은 Base64 안의 마지막 숫자 r 때문입니다. date_index로 지정합니다.
# r=1 (기본): 이번 주 — http://comci.net:4082/36179?NzM2MjlfNDk2NTRfMF8x 와 동일
get_timetable(49654, grade=1, class_num=1, date_index=1)
# r=2: 다음 주 — ...NzM2MjlfNDk2NTRfMF8y 와 동일
get_timetable(49654, grade=1, class_num=1, date_index=2)
3. 전체 학년/반 시간표 조회
# 학년, 반 미지정 시 전체
timetable = get_timetable(49654)
# {"1학년 1반": {...}, "1학년 2반": {...}, ...}
4. 검색 후 바로 시간표 조회
from comci import search_and_get_timetable
timetable = search_and_get_timetable("신송", school_index=0, grade=1, class_num=1)
# 다음 주: date_index=2
timetable_next = search_and_get_timetable("신송", school_index=0, grade=1, class_num=1, date_index=2)
프로젝트 구조
comci/
├── __init__.py # 패키지 진입점
├── config.py # API URL, 상수
├── school_search.py # 학교 검색
├── timetable.py # 시간표 API 및 파싱
└── client.py # 통합 클라이언트
예시 실행
python example_usage.py
시간표 데이터 구조
각 요일별 리스트는 교시(1~8) 순서이며, 각 항목은:
{
"period": 1, # 교시
"time": "08:40", # 시간
"subject": "국어", # 과목
"teacher": "김선생", # 교사
"room": "101", # 강의실
"changed": False # 변경 수업 여부
}
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
comci-0.3.0.tar.gz
(9.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
comci-0.3.0-py3-none-any.whl
(11.8 kB
view details)
File details
Details for the file comci-0.3.0.tar.gz.
File metadata
- Download URL: comci-0.3.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
53565b416f5ee67ae529c8df7f31f44a720c1f1efabdbe491e7e2ec8aada01cf
|
|
| MD5 |
1daac96bc9a9f5d7732ebc16581abd3b
|
|
| BLAKE2b-256 |
d99eea2f4af6be5fff7e94a23c28450a51891c15155c06869d042dc13f408fc1
|
File details
Details for the file comci-0.3.0-py3-none-any.whl.
File metadata
- Download URL: comci-0.3.0-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2957ca032fd1901f121721e47a7e4b6af904df96909e2ff3398f7b63f7174d1
|
|
| MD5 |
8a6a6836f5a4dbb9d91281ed8c1dd43e
|
|
| BLAKE2b-256 |
0430cf06f756cf9589cdbd160f4c58f474d1e2796e97b64c096890210c579126
|