corvix.ingestion¶
GitHub notifications ingestion client.
Attributes¶
Classes¶
Client for GitHub notifications API. |
Functions¶
|
Return value as a JSON object when it is a dict. |
|
Raise ValueError if thread_id is not a valid GitHub notification thread ID. |
|
|
|
|
|
Module Contents¶
- corvix.ingestion._as_json_object(value: corvix.types.JsonValue) corvix.types.JsonObject | None[source][source]¶
Return value as a JSON object when it is a dict.
- corvix.ingestion._validate_thread_id(thread_id: str) None[source][source]¶
Raise ValueError if thread_id is not a valid GitHub notification thread ID.
GitHub thread IDs are positive decimal integers. Rejecting anything that does not match prevents path-traversal sequences such as
../from being embedded in the URL path constructed by callers.
- corvix.ingestion._coerce_json_value(value: object) corvix.types.JsonValue[source][source]¶
- class corvix.ingestion.GitHubNotificationsClient[source][source]¶
Client for GitHub notifications API.
- fetch_notifications(polling: corvix.config.PollingConfig) list[corvix.domain.Notification][source][source]¶
Fetch notifications with pagination.
- _fetch_page(polling: corvix.config.PollingConfig, page: int, timeout_seconds: float) list[corvix.types.JsonObject][source][source]¶
- dismiss_thread(thread_id: str) None[source][source]¶
Dismiss a notification thread (removes it from inbox permanently).
- fetch_json_url(url: str, timeout_seconds: float = 30.0) corvix.types.JsonValue[source][source]¶
Fetch JSON from a fully-qualified API URL with host validation.
- _instrument_request(method: str) collections.abc.Iterator[None][source][source]¶
Record GitHub API request count/latency metrics and a trace span.
Labels successful calls
"success"and failed calls by HTTP status code (forHTTPError) or"error"(for other failures).
- _request_json(url: str, method: str, timeout_seconds: float | None = None) corvix.types.JsonValue[source][source]¶
- _request_no_content(url: str, method: str, timeout_seconds: float | None = None) None[source][source]¶
- _request_no_content_with_backoff(url: str, method: str, max_attempts: int = 4) None[source][source]¶
Perform no-content request with retries for GitHub throttling responses.
- _sanitize_api_url(url: str) str[source][source]¶
Validate
urland return a safe reconstruction using the trusted base host.Reconstructs the URL with the scheme and netloc from
self.api_base_urlso that only the path and query from the input survive into the request. This neutralises SSRF via scheme injection or host-header manipulation while still allowing the caller to supply the full API path.