Skip to main content

서울 지하철 실시간 도착 확인

Project description

seoul-metro-realtime

서울 지하철 실시간 도착 정보를 확인하는 Python CLI 도구다.

서울시 Open API의 realtimeStationArrival 응답을 읽어 역별 도착 요약을 출력한다.

준비

  • 서울시 Open API 키
  • Python 3.12+
  • uv 또는 pip

사용 방법

API 키 설정

현재 작업 디렉터리에 .env 파일을 만들고 키를 넣는다.

.env:

SEOUL_OPEN_API_KEY=your_api_key_here

또는 환경변수로 직접 넣어도 된다.

export SEOUL_OPEN_API_KEY=your_api_key_here

uvx로 바로 실행

uvx를 쓰면 설치 없이 바로 실행할 수 있다.

uvx seoul-metro-realtime 서울역

SEOUL_OPEN_API_KEY 환경변수가 있거나, 현재 작업 디렉터리에 .env가 있으면 된다.

JSON 출력이 필요하면 --json 옵션을 붙인다.

uvx seoul-metro-realtime --json 서울역

설치 후 실행

pip install seoul-metro-realtime
seoul-metro-realtime 서울역
seoul-metro-realtime --json 서울역

환경변수 우선순위는 아래와 같다.

  1. SEOUL_OPEN_API_KEY 환경변수
  2. 현재 작업 디렉터리의 .env
  3. 패키지 루트의 .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

seoul_metro_realtime-0.1.2.tar.gz (22.3 kB view details)

Uploaded Source

Built Distribution

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

seoul_metro_realtime-0.1.2-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file seoul_metro_realtime-0.1.2.tar.gz.

File metadata

  • Download URL: seoul_metro_realtime-0.1.2.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for seoul_metro_realtime-0.1.2.tar.gz
Algorithm Hash digest
SHA256 77d5ff97a0a3d6a80acdf0b13dcd6cb4a900fda6ccc28342ad69847e82b318e1
MD5 512d4e912fe37c0c06c9bcef8cd7c9a5
BLAKE2b-256 02e63d7ef63e225a1c7a1786f7d21c9d2c56d8c6997d13580be24cb2d0d7dab2

See more details on using hashes here.

File details

Details for the file seoul_metro_realtime-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for seoul_metro_realtime-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e6dea914407c943077c30787c20883197cb94084c2cd73468005c42c2a1349b2
MD5 e357e78cab1d1f6fe629d1d38e7f33de
BLAKE2b-256 462ed2fb00ab1ad15dca5cbb1f339d91a6943b4e18b7a9a9ffb016ed5cbfe063

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