speasy.core.http module

class speasy.core.http.Response(response: HTTPResponse)[source]

Bases: object

property bytes
property headers
json()[source]
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) bool[source]

Checks if a server is up and running.

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

speasy.core.http.urlopen(url, timeout: int = 60, headers: dict | None = None)[source]