执行 HTTP GET 请求,返回响应文本。
(url: str, timeout: int = 15)
| 308 | |
| 309 | |
| 310 | def _http_get(url: str, timeout: int = 15) -> str: |
| 311 | """执行 HTTP GET 请求,返回响应文本。""" |
| 312 | req = urllib.request.Request( |
| 313 | url, |
| 314 | headers={"User-Agent": "SmartNode-TLE-Importer/1.0 (satellite simulation)"}, |
| 315 | ) |
| 316 | with urllib.request.urlopen(req, timeout=timeout) as resp: |
| 317 | return resp.read().decode("utf-8", errors="replace") |
| 318 | |
| 319 | |
| 320 | # --------------------------------------------------------------------------- |
no outgoing calls
no test coverage detected