让免费层限流的报告跟真实限流一致,并给少一块结果的静默失败留下函数名和错误类型。

Co-Authored-By: Grok (agent loop)
This commit is contained in:
jesse-ux
2026-10-15 23:12:56 +08:00
co-authored by Grok (agent loop)
parent e4ff62c738
commit a7162db271
38 changed files with 706 additions and 129 deletions
+6 -1
View File
@@ -18,6 +18,7 @@ from typing import Dict, Optional, Tuple, List
from datetime import datetime, timedelta, timezone
from zoneinfo import ZoneInfo
import math
import logging
import sys
import os
@@ -30,6 +31,8 @@ try:
except ImportError:
HAS_SWE = False
logger = logging.getLogger(__name__)
def _gregorian_calendar_flag() -> int:
"""Return the Gregorian calendar flag across swisseph builds."""
@@ -140,7 +143,9 @@ def _get_sun_lon_jd(jd_ut: float, ayanamsa_name: str = 'lahiri') -> Optional[flo
try:
res = swe.calc_ut(jd_ut, swe.SUN, sidereal_flags(swe, ayanamsa_name))
return float(res[0][0] % 360.0)
except Exception:
except Exception as exc:
logger.warning("solar_return._get_sun_lon_jd degraded: %s", type(exc).__name__)
logger.debug("solar_return._get_sun_lon_jd degraded", exc_info=True)
return None