인라인 스타일로 수정

This commit is contained in:
2025-06-27 15:11:00 +09:00
parent 4d31353a79
commit 385bb5290d

View File

@ -39,26 +39,13 @@ def get_precipitation_summary(retry=True):
total_rainfall = 0.0
lines = [
'<style>',
'.weatherinfo table {',
' border-collapse: collapse;',
' border-spacing: 0;',
' display: inline-table;',
'}',
'.weatherinfo td, .weatherinfo th {',
' padding: 0;',
' border: 1px solid #333;',
'}',
'.weatherinfo h3 {',
' font-size: 2em;',
' text-align: center;',
' margin: 20px 0;',
'}',
'</style>',
'<div class="weatherinfo">',
'<h3>[시간대별 강수량]</h3>',
'<table>',
'<tr><th>시간</th><th>강수량</th></tr>'
'<div class="weatherinfo" style="text-align:center;">',
'<h3 style="font-size: 2em; margin: 20px 0;">[시간대별 강수량]</h3>',
'<table style="border-collapse: collapse; border-spacing: 0; display: inline-table; margin: 0 auto;">',
'<tr>',
'<th style="padding: 0; border: 1px solid #333;">시간</th>',
'<th style="padding: 0; border: 1px solid #333;">강수량</th>',
'</tr>'
]
for item in data['response']['body']['items']['item']:
@ -67,7 +54,7 @@ def get_precipitation_summary(retry=True):
if 900 < int(time) < 2300:
mm = parse_precip(item['fcstValue'])
time_str = f"{time[:2]}:{time[2:]}" # '11:00'
lines.append(f'<tr><td>{time_str}</td><td>{mm}mm</td></tr>')
lines.append(f'<tr><td style="padding: 0; border: 1px solid #333;">{time_str}</td><td style="padding: 0; border: 1px solid #333;">{mm}mm</td></tr>')
total_rainfall += mm
lines.append('</table></div>')