---
name: infra-core-http-polling
description: Use when working with infra-core HTTP helpers, status polling, or asset download workflows. Covers choosing between fetch/fetch_async/request_async, poll_until/poll_until_async, StatusPoller, download_asset helpers, and the main usage constraints.
---

# infra-core-http-polling

Use this skill when the task is about retried HTTP calls, polling long-running operations, or downloading remote files with infra-core.

## Preferred imports

- `from infra_core import fetch, fetch_async, request_async`
- `from infra_core import poll_until, poll_until_async, StatusPoller, PollingConfig`
- `from infra_core import download_asset, download_asset_async, AssetDownloadClient`

## Selection guide

- Use `fetch` / `fetch_async` for ordinary HTTP fetches with retry/backoff defaults.
- Use `request_async` when you need non-GET requests or the full `httpx.Response`.
- Use `poll_until` / `poll_until_async` when a remote operation should be polled until it reaches a terminal state.
- Use `StatusPoller` when the calling code benefits from a reusable polling object instead of free functions.
- Use `download_asset_async` or `AssetDownloadClient` for file downloads that need retry logic, connection reuse, or checksums.
- Use `download_asset` only from non-async code. It fails inside a running event loop by design.

## Important behavior

- `poll_until_async` accepts async fetchers, sync fetchers, and sync wrappers that return awaitables.
- HTTP helpers sanitize URLs in logs; avoid adding duplicate secret-bearing logs around them.
- Prefer top-level `infra_core` imports unless you are changing implementation internals.
- If you add a new public helper in this area, update `CAPABILITIES.md` and `src/infra_core/capabilities.py`.

## Read next when needed

- [CAPABILITIES.md](../../CAPABILITIES.md)
- [README.md](../../README.md)
- [src/infra_core/polling.py](../../src/infra_core/polling.py)
- [src/infra_core/http.py](../../src/infra_core/http.py)
- [src/infra_core/http_async.py](../../src/infra_core/http_async.py)
- [src/infra_core/asset_client.py](../../src/infra_core/asset_client.py)
- [examples/http_fetch_with_retries.py](../../examples/http_fetch_with_retries.py)
- [examples/poll_remote_job.py](../../examples/poll_remote_job.py)
- [examples/bounded_async_runtime.py](../../examples/bounded_async_runtime.py)
- [tests/test_polling.py](../../tests/test_polling.py)
- [tests/test_http.py](../../tests/test_http.py)
- [tests/test_http_async.py](../../tests/test_http_async.py)
- [tests/test_asset_client.py](../../tests/test_asset_client.py)
