제목 표시 및 본문 시간 가독성 향상
This commit is contained in:
@ -37,16 +37,18 @@ def get_precipitation_summary():
|
|||||||
try:
|
try:
|
||||||
data = response.json()
|
data = response.json()
|
||||||
total_rainfall = 0.0
|
total_rainfall = 0.0
|
||||||
lines = [f"<p>시간대별 강수량 :</p><ul>"]
|
lines = [f"<h3>[시간대별 강수량]</h3><ul>"]
|
||||||
|
|
||||||
for item in data['response']['body']['items']['item']:
|
for item in data['response']['body']['items']['item']:
|
||||||
if item['category'] == 'PCP' and item['fcstDate'] == TODAY:
|
if item['category'] == 'PCP' and item['fcstDate'] == TODAY:
|
||||||
time = item['fcstTime']
|
time = item['fcstTime'] # 예: '1100'
|
||||||
if 900 < int(time) < 2300:
|
if 900 < int(time) < 2300:
|
||||||
mm = parse_precip(item['fcstValue'])
|
mm = parse_precip(item['fcstValue'])
|
||||||
lines.append(f"<li>{time}시 → {mm}mm</li>")
|
time_str = f"{time[:2]}:{time[2:]}" # '11:00'
|
||||||
|
lines.append(f"<li>{time_str} → {mm}mm</li>")
|
||||||
total_rainfall += mm
|
total_rainfall += mm
|
||||||
|
|
||||||
|
|
||||||
lines.append("</ul>")
|
lines.append("</ul>")
|
||||||
lines.append(f"<p>영업시간 중 총 예상 강수량: <strong>{total_rainfall:.1f}mm</strong></p>")
|
lines.append(f"<p>영업시간 중 총 예상 강수량: <strong>{total_rainfall:.1f}mm</strong></p>")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user