speasy.core.http module
- class speasy.core.http.Response(response: HTTPResponse)[source]
Bases:
object
- property bytes
- property headers
- property ok
- property status_code
- property text
- property url
- speasy.core.http.is_server_up(url: str | None = None, host: str | None = None, port: int | None = None, timeout: int = 5, retries=5) bool [source]
Checks if a server is up and running. If url is provided, host and port are ignored.
- Parameters:
- urlOptional[str]
url to check (scheme://host[:port]), if provided host and port are ignored
- hostOptional[str]
host to check, if provided port must be provided as well
- portOptional[int]
port to check, if provided host must be provided as well
- timeoutint
timeout in seconds
- Returns:
- bool
True if server is up and running, False otherwise
- Raises:
- ValueError
If neither url nor host and port are provided