http:// and https:// schemes, managing connection pooling and timeouts automatically.
The HTTP provider is registered by default—no configuration required.
Configuration
Configure the HTTP provider incolin.toml to customize timeout behavior:
colin.toml
| Field | Description | Default |
|---|---|---|
timeout | Request timeout in seconds | 30.0 |
Template Functions
The HTTP provider exposes one function:| Function | Purpose |
|---|---|
get() | Fetch content from a URL |
Get
Usecolin.http.get() to fetch content from any URL:
models/sources/api-data.md
https://:
HTTPResource object with content and metadata:
| Property | Description |
|---|---|
.content | Response body as a string |
.uri | The requested URL |
.content_type | Content-Type header value |
.updated | Last-Modified timestamp, if available |
Objects
HTTPResource - Returned byget():
| Property | Type | Description |
|---|---|---|
uri | str | Requested URL |
content | str | Response body |
content_type | str | None | Content-Type header |
updated | datetime | None | Last-Modified time |
RefResult via the to_ref_result() method.
URI Support
URLs starting withhttp:// or https:// work directly with ref():
colin.http.get() but automatically tracks the dependency.
Dependency Tracking
HTTP resources can be tracked as dependencies usingref():
Staleness Detection
The HTTP provider supports efficient staleness checking via HEAD requests. When Colin evaluates whether a document needs recompilation, it checksLast-Modified headers without downloading full content.
If the server provides a Last-Modified header, Colin compares it against the cached timestamp. Resources without this header are treated as potentially stale.
Working with APIs
The HTTP provider works well with JSON APIs. Combine with LLM functions to process API responses:models/sources/github-issues.md
models/context/issue-summary.md
Authenticated Requests
The HTTP provider supports unauthenticated requests only. For APIs requiring authentication, use an MCP server that handles credentials:colin.toml
Error Handling
The provider raises specific exceptions for HTTP errors:| Status | Exception |
|---|---|
| 404 | FileNotFoundError |
| Other 4xx/5xx | httpx.HTTPStatusError |
Lifecycle
The HTTP provider manages anhttpx.AsyncClient through its lifespan context. Colin creates the client when starting compilation and closes it on shutdown. This connection pooling improves performance when fetching multiple URLs from the same host.