서울 지하철 실시간 도착 확인
Project description
seoul-metro-realtime
서울 지하철 실시간 도착 정보를 확인하는 Python CLI 도구다.
서울시 Open API의 realtimeStationArrival 응답을 읽어 역별 도착 요약을 출력한다.
준비
- 서울시 Open API 키
- Python 3.12+
uv또는pip
사용 방법
API 키 설정
처음 한 번만 configure로 서울시 Open API 키를 저장한다.
uvx seoul-metro-realtime configure
설치해서 쓴다면 아래 명령도 같다.
seoul-metro-realtime configure
설정 파일은 ~/.config/seoul-metro-realtime/config.env에 저장된다.
환경변수로 직접 넣어도 된다.
export SEOUL_OPEN_API_KEY=your_api_key_here
프로젝트별 키를 쓰려면 현재 작업 디렉터리에 .env 파일을 만든다.
.env:
SEOUL_OPEN_API_KEY=your_api_key_here
uvx로 바로 실행
uvx를 쓰면 설치 없이 바로 실행할 수 있다.
uvx seoul-metro-realtime 서울역
API 키 설정이 없으면 configure 실행을 안내한다.
JSON 출력이 필요하면 --json 옵션을 붙인다.
uvx seoul-metro-realtime --json 서울역
설치 후 실행
pip install seoul-metro-realtime
seoul-metro-realtime 서울역
seoul-metro-realtime --json 서울역
환경변수 우선순위는 아래와 같다.
SEOUL_OPEN_API_KEY환경변수- 현재 작업 디렉터리의
.env ~/.config/seoul-metro-realtime/config.env- 패키지 루트의
.env
출력 형식
기본 출력은 사람이 읽기 쉬운 텍스트다.
서울 실시간 도착정보
1호선
- 남영방면
- 인천행: 2분 후 도착
경의중앙선
- 효창공원앞방면
- 문산행: 4분 후 도착 (급행, 막차)
--json 옵션을 주면 아래 구조로 출력한다.
{
"station_name": "서울",
"generated_at": "2026-04-08T10:05:30+00:00",
"arrivals": [
{
"line_name": "1호선",
"direction": "남영방면",
"destination": "인천행",
"eta": "1분 후 도착",
"seconds": 60,
"status": "일반",
"is_last_train": false,
"arvl_msg2": "",
"arvl_cd": "99"
},
{
"line_name": "경의중앙선",
"direction": "효창공원앞방면",
"destination": "문산행",
"eta": "3분 후 도착",
"seconds": 210,
"status": "급행",
"is_last_train": true,
"arvl_msg2": "",
"arvl_cd": "99"
}
]
}
JSON 필드 설명
station_name:역접미사를 제거한 역 이름generated_at: 응답을 가공한 시각 ISO 8601 문자열arrivals: 도착 예정 정보 배열line_name: 호선 이름direction: 방면 정보destination: 행선지eta: 사람이 읽기 쉬운 도착 문구seconds: 보정된 남은 초status: 열차 상태. 예:일반,급행is_last_train: 막차 여부arvl_msg2: Open API 원본 도착 메시지arvl_cd: Open API 원본 도착 코드
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
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
File details
Details for the file seoul_metro_realtime-0.2.0.tar.gz.
File metadata
- Download URL: seoul_metro_realtime-0.2.0.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0983f57e69e2597324e27be52826a8ffbbd30e8cb09c057c9af4c30f235d776
|
|
| MD5 |
bb2d4fdb3d30aa095bd2ab96f062d47b
|
|
| BLAKE2b-256 |
8ea1d235f3b441d304a0abf3791ada0fee5e951613316f609b3c4cb858e7a442
|
File details
Details for the file seoul_metro_realtime-0.2.0-py3-none-any.whl.
File metadata
- Download URL: seoul_metro_realtime-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2feedd41117763b968f519051d8af34ad09baf276b44a33c066574fad33f918b
|
|
| MD5 |
7fcac072088e00b61d18a26e6f8c8000
|
|
| BLAKE2b-256 |
4aced29fc61375ad463959bca864283165fc0e23912e11d4d56fd1a204f730cd
|