nectarapi.node module
- class nectarapi.node.Node(url: str)
Bases:
object
- class nectarapi.node.Nodes(urls: str | Nodes | List[Any] | tuple | set | None, num_retries: int, num_retries_call: int)
Bases:
list[Node]Stores Node URLs and error counts
- disable_node() None
Disable current node
- property error_cnt: int
- property error_cnt_call: int
- export_working_nodes() List[str]
- get_nodes() List[str]
Return the list of configured node URLs (including those currently marked errored).
- increase_error_cnt() None
Increase node error count for current node
- increase_error_cnt_call() None
Increase call error count for current node
- next() str
- property num_retries_call_reached: bool
- reset_error_cnt() None
Set node error count for current node to zero
- reset_error_cnt_call() None
Set call error count for current node to zero
- sleep_and_check_retries(errorMsg: str | None = None, sleep: bool = True, call_retry: bool = False, showMsg: bool = True) None
Sleep and check if num_retries is reached. If num_retries is reached, raise NumRetriesReached or CallRetriesReached. Only logs first and last retry messages if showMsg is True.
- Parameters:
errorMsg – Optional error message to log
sleep – Whether to sleep before retrying
call_retry – Whether this is a retry for a call error (as opposed to a connection error)
showMsg – Whether to show retry messages only on the first and last retry
- property url: str
- property working_nodes_count: int