-
-
Save tebeka/8755a8e114984201fac7e4cfefb3cc76 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib.request import URLError, urlopen | |
from http import HTTPStatus | |
class Client: | |
def __init__(self, host, port): | |
self.__address = f'https://{host}:{port}' | |
def health(self): | |
url = f'{self.__address}/health' | |
try: | |
with urlopen(url) as fp: | |
return fp.status == HTTPStatus.OK | |
except URLError: | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment