Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8bb642f
refactor: cache 형식 수정 및 convert로직 변경
hyuntroll Sep 25, 2025
4ab4729
test: cache 태스트
hyuntroll Sep 25, 2025
ce66d92
docs: Update README.md
hyuntroll Sep 25, 2025
67c48d3
feat: create BaseList extends list
hyuntroll Sep 28, 2025
637f8b9
refactor: renamed from http.py
hyuntroll Sep 28, 2025
6a04dbe
refactor: client 및 cache_util 구조 변경
hyuntroll Sep 28, 2025
61aacb1
refactor: convert_model로 수정 및 코드 리팩토링
hyuntroll Sep 28, 2025
6f0c2af
chore: BaseList를 통한 리스트 형태 반환 및 client 주입 메서드 삭제
hyuntroll Sep 28, 2025
b131ed3
chore
hyuntroll Sep 28, 2025
6e4c20b
test: client 테스트 코드 작성
hyuntroll Sep 28, 2025
2f27f46
chore: dictionary로 수정하는 코드 수정 및 테스트 코드
hyuntroll Sep 28, 2025
67a1193
refactor: model_convert 데코레이터 cache 사용여부 변경
hyuntroll Sep 29, 2025
f025f0e
chore: Model에서 from_list 오버라이딩 삭제 및 데코레이터 이름 수정(convert_model), 테스트 코…
hyuntroll Sep 29, 2025
5def686
chore: Model에서 from_list 오버라이딩 삭제 및 데코레이터 이름 수정(convert_model), 테스트 코…
hyuntroll Sep 29, 2025
f46eeea
feat: BaseModel LazyLoading 구현
hyuntroll Sep 29, 2025
0c8552e
feat: BaseModel 필드에 cityCode 삽입
hyuntroll Sep 29, 2025
0674d68
chore: client _get요청시 cityCode도 함께 convert되도록 수정
hyuntroll Sep 29, 2025
76f1a5f
feat: set Lazy_fields in Station
hyuntroll Sep 29, 2025
9ac35d7
feat: set Lazy_fields in ArrivalInfo and Vehicle
hyuntroll Sep 30, 2025
acd454a
fix: _clinet 속성 접근 시 _client가 None일 때 RunTimeError 예외가 발생하는 것을 수정
hyuntroll Oct 7, 2025
92269fe
feat: Station lazy_field 일부 추가
hyuntroll Oct 11, 2025
db377a5
chore: ArrivalInfo, Vehicle attribute 수정
hyuntroll Oct 11, 2025
afbaee5
docs: README 개체 속성 수정
hyuntroll Oct 13, 2025
a01b971
refactor: refactor utils
hyuntroll Oct 13, 2025
6f5ec28
test: 조회 후 캐시 저장 확인 테스트
hyuntroll Oct 25, 2025
fd5959a
chore: cache 저장 구조 변경
hyuntroll Nov 12, 2025
72faddc
chore: model convert 시 citycode가 누락되는 문제 해결
hyuntroll Nov 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ tests/__pycache__
.env
caches/cache.pkl
.vscodeoutput.json
.tagoapi


tagoapi/caches/station.pkl
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

110 changes: 59 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,63 +76,71 @@ print(stations)
- `Route` : 버스 노선 정보
- `ArrivalInfo` : 버스 도착 정보

#### 공통 메서드
~~~python
obj.to_dict() # 객체 → dict 변환
ClassName.from_dict(dict) # dict → 객체 변환
ClassName.from_list(list) # dict 리스트 → 객체 리스트 변환
~~~

---

### 도메인 객체 필드 목록

#### **Station**
| 필드명 | 타입 | 설명 |
|--------|------|------|
| `nodeId` | `str` | 정류소 ID |
| `nodeNm` | `str` | 정류소명 |
| `nodeNo` | `int` | 정류소 번호 |
| `gpsLati` | `float` | 위도 (WGS84) |
| `gpsLong` | `float` | 경도 (WGS84) |
| `cityCode` | `int` | 도시코드 |
| `updowncd` | `int` | 상하행구분코드 (`0`: 상행, `1`: 하행) |
| `nodeord` | `int` | 정류소순번 |

#### **Route**
| 필드명 | 타입 | 설명 |
|--------|------|------|
| `routeId` | `str` | 노선 ID |
| `routeNo` | `str` | 노선명 |
| `routeTp` | `int` | 노선유형 |
| `endNodeNm` | `str` | 종점 |
| `startNodeNm` | `str` | 기점 |
| `endvehicletime` | `int` | 막차시간 |
| `startvehicletime` | `int` | 첫차시간 |

#### **ArrivalInfo**
| 필드명 | 타입 | 설명 |
|--------|------|------|
| `nodeId` | `str` | 정류소 ID |
| `nodeNm` | `str` | 정류소명 |
| `routeId` | `str` | 노선 ID |
| `routeNo` | `str` | 노선명 |
| `routeTp` | `int` | 노선유형 |
| `arrprevstationcnt` | `int` | 노선유형 |
| `vehicletp` | `str` | 차랑유형 |
| `arrtime` | `int` | 도착예상시간 |

#### **Vehicle**
| 필드명 | 타입 | 설명 |
|--------|------|------|
| `routeId` | `str` | 노선 ID |
| `routeNo` | `str` | 노선명 |
#### **BaseModel**
도메인 객체들의 상위 객체 입니다.

다음과 같은 공통 메서드를 제공합니다.
~~~python
obj.to_dict() # 객체 → dict 변환
BaseModel.from_dict(dict) # dict → 객체 변환
BaseModel.from_list(list) # dict 리스트 → 객체 리스트 변환
~~~

### **BaseList**
도메인 객체들을 요소로 갖는 list 입니다.
기본적으로 Python의 기본 자료형인 list를 상속 받습니다.

### **Station**
| 필드명 | 타입 | 설명 |
|------------|-------------------|------------------------|
| `nodeId` | `str` | 정류소 ID |
| `nodeNm` | `str` | 정류소명 |
| `nodeNo` | `int` | 정류소 번호 |
| `gpsLati` | `float` | 위도 (WGS84) |
| `gpsLong` | `float` | 경도 (WGS84) |
| `cityCode` | `int` | 도시코드 |
| `updowncd` | `int` | 상하행구분코드 (`0`: 상행, `1`: 하행) |
| `nodeord` | `int` | 정류소순번 |
| `routes` | `BaseList[Route]` | 정류소를 경유하는 노선 |


### **Route**
| 필드명 | 타입 | 설명 |
|--------------------|---------------------|--------------|
| `routeId` | `str` | 노선 ID |
| `routeNo` | `str` | 노선명 |
| `routeTp` | `int` | 노선유형 |
| `endNodeNm` | `str` | 종점 |
| `startNodeNm` | `str` | 기점 |
| `endvehicletime` | `int` | 막차시간 |
| `startvehicletime` | `int` | 첫차시간 |
| `stations` | `BaseList[Station]` | 노선이 경유하는 정류소 |


### **ArrivalInfo**
| 필드명 | 타입 | 설명 |
|---------------------|-----------|--------|
| `node` | `Station` | 정류소 정보 |
| `route` | `Route` | 노선 정보 |
| `arrprevstationcnt` | `int` | 노선유형 |
| `vehicletp` | `str` | 차랑유형 |
| `arrtime` | `int` | 도착예상시간 |

### **Vehicle**
| 필드명 | 타입 | 설명 |
|--------|---------|------------|
| `route` | `Route` | 노선 정보 |
| `gpsLati` | `float` | 위도 (WGS84) |
| `gpsLong` | `float` | 경도 (WGS84) |
| `arrtime` | `int` | 도착예상시간 |
| `arrprevstationcnt` | `int` | 노선유형 |
| `vehicleTp` | `str` | 차랑유형 |
| `vehicleNo` | `str` | 차랑번호 |
| `arrtime` | `int` | 도착예상시간 |
| `arrprevstationcnt` | `int` | 노선유형 |
| `vehicleTp` | `str` | 차랑유형 |
| `vehicleNo` | `str` | 차랑번호 |



Expand All @@ -153,4 +161,4 @@ ClassName.from_list(list) # dict 리스트 → 객체 리스트 변환

---
### 5. 오류 및 이슈
버그 제보 또는 기능 요청은 [GitHub 이슈](https://github.com/hyuntroll/TAGOBus-API/issues)에 등록해주세요.
버그 제보 또는 기능 요청은 [GitHub 이슈](https://github.com/hyuntroll/TAGOBus-API/issues)에 등록해주세요.
12 changes: 4 additions & 8 deletions tagoapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@
from .auth import TAGOAuth


from .models import Route
from .models import Vehicle
from .models import Station
from .models import *

# from .utils import get_city_code
from .utils.cache_util import from_cache_or_fetch
from .utils.parser import KeyExtract
from .utils.cache_util import cache
from .utils.get_station import get_station



__all__ = [ 'TAGOClient', 'TAGOAuth', 'from_cache_or_fetch', 'Route', 'Vehicle', 'Station', 'KeyExtract', 'cache', 'get_station' ]


__all__ = [ 'TAGOClient', 'TAGOAuth', 'BaseModel', 'BaseList', 'Route', 'Vehicle', 'Station' ]
Binary file modified tagoapi/caches/cache.pkl
Binary file not shown.
Binary file modified tagoapi/caches/station.pkl
Binary file not shown.
Loading
Loading