_lines10. Internal helper function. This docstring was added automatically to improve maintainability. Args: val: Parameter. Returns: Varies.
(val: str)
| 10936 | "showers": current.get("showers"), "snowfall": current.get("snowfall"), "cloud_cover": current.get("cloud_cover"), |
| 10937 | "pressure": current.get("surface_pressure"), "wind_speed": current.get("wind_speed_10m"), "wind_direction": current.get("wind_direction_10m"), |
| 10938 | "wind_gusts": current.get("wind_gusts_10m"), "weather_code": current.get("weather_code"), "description": description, "icon": icon, |
| 10939 | } |
| 10940 | return jsonify({ |
| 10941 | "ok": True, |
| 10942 | "location": {"label": label, "latitude": latitude, "longitude": longitude, "timezone": raw.get("timezone") or "", "elevation": raw.get("elevation")}, |
| 10943 | "current": normalized_current, |
| 10944 | "daily": _weather_daily_rows(raw, lang), |
| 10945 | "generated_at": now_z(), |
| 10946 | "source": "Open-Meteo", |
| 10947 | }) |
| 10948 | |
| 10949 | |
| 10950 | # --------------------------- |
| 10951 | # World News (RSS aggregation; cached) |
| 10952 | # --------------------------- |
| 10953 | |
| 10954 | # Cache is per-language (English/Greek), refreshed every _NEWS_TTL seconds. |
| 10955 | _NEWS_CACHE = {"ts": {"en": 0.0, "el": 0.0}, "items": {"en": [], "el": []}} # in-memory cache |
| 10956 | _NEWS_LOCK = threading.Lock() |
| 10957 | _NEWS_TTL = 20 * 60 # seconds |
| 10958 | |
| 10959 | # Topics the user asked for (plus similar). We use Google News RSS search to get "worldwide" coverage. |
| 10960 | NEWS_TOPICS = [ |
| 10961 | ("cybersecurity", {"en": "Cybersecurity", "el": "Κυβερνοασφάλεια"}, |
| 10962 | {"en": "cybersecurity OR infosec OR \"data breach\"", "el": "κυβερνοασφάλεια OR ασφάλεια πληροφοριών OR \"διαρροή δεδομένων\""}), |