From dbc4f462a85afc16f99625785ddae4d2d4fd7a14 Mon Sep 17 00:00:00 2001 From: kunal-10-cloud Date: Sun, 19 Apr 2026 02:31:56 +0530 Subject: [PATCH] Surface ipinfo.io location check failures Closes #1311. The ipinfo.io lookup in AnophelesBase swallowed every OSError silently, leaving _client_details = None. That cascaded into _get_gcp_region() returning None and the GCS URL optimisation falling back to the default bucket without any indication that the location check had failed. Researchers on restricted networks (corporate firewalls, institutional VPNs, regions where ipinfo.io is blocked) hit this path the most, and had no way to correlate slow downloads with a failed lookup. Now the failure is logged at DEBUG level for users running with debug=True, and a UserWarning is emitted explaining the fallback and pointing to the `url` parameter as a manual override. The fallback behaviour itself is unchanged. --- malariagen_data/anoph/base.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/malariagen_data/anoph/base.py b/malariagen_data/anoph/base.py index a5293a539..57ff605ed 100644 --- a/malariagen_data/anoph/base.py +++ b/malariagen_data/anoph/base.py @@ -103,8 +103,16 @@ def __init__( if check_location: try: self._client_details = ipinfo.getHandler().getDetails() - except OSError: - pass + except OSError as exc: + self._log.debug(f"Location check failed: {exc}") + warnings.warn( + "Could not determine client location via ipinfo.io " + f"({exc}). Region-optimal GCS bucket selection is " + "unavailable. You can manually specify a region using " + "the `url` parameter.", + UserWarning, + stacklevel=2, + ) # Determine cloud location details. self._gcp_region = _get_gcp_region(self._client_details)