API Reference¶
Stages¶
Base Classes¶
base
¶
Base classes for stages.
Classes¶
Status
¶
CheckResult
dataclass
¶
CheckContext
dataclass
¶
Context passed between stages in a pipeline.
Source code in src/uptimer/stages/base.py
Stage
¶
Bases: ABC
Base class for all stages.
Source code in src/uptimer/stages/base.py
Functions¶
check(url, verbose=False, context=None)
abstractmethod
¶
Perform the check and return result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
URL to check |
required |
verbose
|
bool
|
Whether to include verbose output |
False
|
context
|
CheckContext | None
|
Optional context from previous stages |
None
|
Returns:
| Type | Description |
|---|---|
CheckResult
|
CheckResult with status, message, and details |
Source code in src/uptimer/stages/base.py
HTTP Stage¶
HttpStage
¶
Bases: Stage
HTTP stage that follows redirects.
Source code in src/uptimer/stages/http.py
Functions¶
__init__(timeout=10.0, headers=None)
¶
Initialize with timeout and optional custom headers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
float
|
Request timeout in seconds |
10.0
|
headers
|
dict[str, str] | None
|
Custom HTTP headers to send with the request |
None
|
Source code in src/uptimer/stages/http.py
check(url, verbose=False, context=None)
¶
Check URL via HTTP GET, following redirects.
Source code in src/uptimer/stages/http.py
Registry¶
registry
¶
Logging¶
logging
¶
Logging configuration using structlog.
Functions¶
configure_logging(json_output=False)
¶
Configure structlog for console or JSON output.