ginipick commited on
Commit
175650f
·
verified ·
1 Parent(s): 8d5e73b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -4
app.py CHANGED
@@ -34,16 +34,37 @@ def fetch_all(limit=200):
34
  · url 필드와 alias 배열을 모두 검색
35
  """
36
  try:
 
 
 
 
 
37
  params = {"limit": limit}
38
  if TEAM:
39
  params["teamId"] = TEAM
40
 
 
 
 
41
  resp = requests.get(f"{API}/v6/deployments",
42
  headers=HEAD, params=params, timeout=30)
43
- resp.raise_for_status()
44
-
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  games = []
46
- for d in resp.json().get("deployments", []):
47
  if d.get("state") != "READY":
48
  continue
49
 
@@ -61,10 +82,13 @@ def fetch_all(limit=200):
61
  "ts": int(d.get("created", time.time() * 1000) / 1000)
62
  })
63
 
 
64
  return sorted(games, key=lambda x: x["ts"], reverse=True)
65
 
66
  except Exception as e:
67
- print("Vercel API 오류:", e)
 
 
68
  return []
69
 
70
 
 
34
  · url 필드와 alias 배열을 모두 검색
35
  """
36
  try:
37
+ # 토큰 검증
38
+ if not TOKEN:
39
+ print("오류: API 토큰이 설정되지 않았습니다")
40
+ return []
41
+
42
  params = {"limit": limit}
43
  if TEAM:
44
  params["teamId"] = TEAM
45
 
46
+ # 요청 로그 추가
47
+ print(f"Vercel API 호출: {API}/v6/deployments (limit={limit})")
48
+
49
  resp = requests.get(f"{API}/v6/deployments",
50
  headers=HEAD, params=params, timeout=30)
51
+
52
+ # 상태 코드 확인 및 오류 처리 개선
53
+ if resp.status_code != 200:
54
+ print(f"API 응답 오류: {resp.status_code}, {resp.text[:200]}")
55
+ return []
56
+
57
+ data = resp.json()
58
+
59
+ # 데이터 구조 검증
60
+ if "deployments" not in data:
61
+ print(f"API 응답에 deployments 필드가 없습니다: {str(data)[:200]}...")
62
+ return []
63
+
64
+ print(f"{len(data['deployments'])}개의 배포를 찾았습니다")
65
+
66
  games = []
67
+ for d in data.get("deployments", []):
68
  if d.get("state") != "READY":
69
  continue
70
 
 
82
  "ts": int(d.get("created", time.time() * 1000) / 1000)
83
  })
84
 
85
+ print(f"6자 도메인 배포 {len(games)}개를 필터링했습니다")
86
  return sorted(games, key=lambda x: x["ts"], reverse=True)
87
 
88
  except Exception as e:
89
+ print(f"Vercel API 오류: {str(e)}")
90
+ import traceback
91
+ traceback.print_exc()
92
  return []
93
 
94