fftools.healthchecks

class fftools.healthchecks.HealthChecks(url: str, path: str, ping_key: str | None = None)[source]

Bases: object

ping healthchecks.

you can use <HOSTNAME> in the path for the formatted hostname of the device.

Parameters:
__init__(url: str, path: str, ping_key: str | None = None) None[source]

init the healthchecks api.

Parameters:
  • url (str) – base url of the healthchecks instance.

  • path (str) – ping path. full path if ping_key is not used, else only the part after the ping_key.

  • ping_key (str | None) – ping key to use. Defaults to None.

Return type:

None

exit_code(exit_code: str | int, message: str | None = None) tuple[int, str][source]

ping with status: exit_code.

send the exit code of the program to healthchecks.

Parameters:
  • exit_code (str | int) – exit code to report.

  • message (str | None) – message to add to ping body. Defaults to None.

Returns:

http response code, http response body

Return type:

tuple with

fail(message: str | None = None) tuple[int, str][source]

ping with status: fail.

fails the current job.

Parameters:

message (str | None) – message to add to ping body. Defaults to None.

Returns:

http response code, http response body

Return type:

tuple with

log(message: str) tuple[int, str][source]

ping with status: log.

sends a log to the current job. does not stop or fail the job.

Parameters:

message (str) – message to add to ping body.

Returns:

http response code, http response body

Return type:

tuple with

start(message: str | None = None) tuple[int, str][source]

ping with status: start.

starts the timer of the healthchecks job.

Parameters:

message (str | None) – message to add to ping body. Defaults to None.

Returns:

http response code, http response body

Return type:

tuple with

success(message: str | None = None) tuple[int, str][source]

ping with status: success.

used to end the job or signal success.

Parameters:

message (str | None) – message to add to ping body. Defaults to None.

Returns:

http response code, http response body.

Return type:

tuple with