MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / _get_with_retries

Function _get_with_retries

misc/python/materialize/mzbuild.py:410–424  ·  view source on GitHub ↗

GET `url`, retrying transient failures; returns None if all retries fail.

(url: str, **kwargs: Any)

Source from the content-addressed store, hash-verified

408
409
410def _get_with_retries(url: str, **kwargs: Any) -> requests.Response | None:
411 """GET `url`, retrying transient failures; returns None if all retries fail."""
412 for sleep_time in [2, 5, 10, None]:
413 try:
414 response = requests.get(url, timeout=10, **kwargs)
415 except requests.RequestException as e:
416 if sleep_time is None:
417 print(f"Error requesting {url}: {e}")
418 return None
419 else:
420 if response.status_code not in _TRANSIENT_REGISTRY_STATUSES:
421 return response
422 if sleep_time is not None:
423 time.sleep(sleep_time)
424 return None
425
426
427# These intentionally do *not* share code with `is_*_image_pushed`: those check

Callers 2

is_docker_image_publicFunction · 0.85
is_ghcr_image_publicFunction · 0.85

Calls 2

getMethod · 0.45
sleepMethod · 0.45

Tested by

no test coverage detected