nvchecker.api — The source plugin API
- exception nvchecker.api.TemporaryError(code, message, response)[source]
A temporary error (e.g. network error) happens.
- class nvchecker.api.BaseWorker(task_sem: Semaphore, result_q: Queue[RawResult], tasks: List[Tuple[str, Dict[str, Any]]], keymanager: KeyManager)[source]
The base class for defining
Workerclasses for source plugins.- task_sem: asyncio.Semaphore
This is the rate-limiting semaphore. Workers should acquire it while doing one unit of work.
- tasks: List[Tuple[str, Entry]]
A list of tasks for the
Workerto complete. Every task consists of a tuple for the task name (table name in the configuration file) and the content of that table (as adict).
- keymanager: KeyManager
The
KeyManagerfor retrieving keys from the keyfile.
- class nvchecker.api.RawResult(name: str, version: VersionResult, conf: Entry)[source]
The unprocessed result from a check.
Create new instance of RawResult(name, version, conf)
- version: None | str | RichResult | List[str | RichResult] | Exception
The result from the check.
- class nvchecker.api.RichResult(*, version: str, gitref: str | None = None, revision: str | None = None, url: str | None = None)[source]
RichResult(*, version: ‘str’, gitref: ‘Optional[str]’ = None, revision: ‘Optional[str]’ = None, url: ‘Optional[str]’ = None)
- class nvchecker.api.AsyncCache[source]
A cache for use with async functions.
- lock: Lock
- async get_json(url: str, *, headers: Dict[str, str] = {}) Any[source]
Get specified
urland return the response content as JSON.The returned data will be cached for reuse.
- async get(key: Hashable, func: Callable[[Hashable], Coroutine[Any, Any, Any]]) Any[source]
Run async
funcand cache its return value bykey.The
keyshould be hashable, and the function will be called with it as its sole argument. For multiple simultaneous calls with the same key, only one will actually be called, and others will wait and return the same (cached) value.
- exception nvchecker.api.GetVersionError(msg: LiteralString, **kwargs: Any)[source]
An error occurred while getting version information.
Raise this when a known bad situation happens.
- Parameters:
msg – The error message.
kwargs – Arbitrary additional context for the error.
- class nvchecker.api.EntryWaiter[source]
- nvchecker.api.session: nvchecker.httpclient.base.BaseSession
The object to send out HTTP requests, respecting various options in the configuration entry.
- class nvchecker.httpclient.base.Response(headers: Mapping[str, str], body: bytes)[source]
The response of an HTTP request.
- nvchecker.api.proxy = <ContextVar name='proxy' default=None>
- nvchecker.api.user_agent = <ContextVar name='user_agent' default='lilydjwg/nvchecker 2.21dev'>
- nvchecker.api.tries = <ContextVar name='tries' default=1>
- nvchecker.api.verify_cert = <ContextVar name='verify_cert' default=True>
- nvchecker.api.entry_waiter: contextvars.ContextVar
This
ContextVarcontains anEntryWaiterinstance for waiting on other entries.