refactor and docstring
This commit is contained in:
parent
e5a2fbd002
commit
464349be09
1 changed files with 9 additions and 1 deletions
|
|
@ -6,7 +6,14 @@ from xecd_rates_client import XecdClient
|
|||
logger = logging.getLogger()
|
||||
|
||||
|
||||
def run_xe_healthcheck():
|
||||
def run_xe_healthcheck() -> None:
|
||||
"""
|
||||
Try to request the account data in xe.com's API.
|
||||
|
||||
If certain fields about the account are returned, it means the request was
|
||||
successful.
|
||||
|
||||
"""
|
||||
logger.info("Creating client.")
|
||||
xecd = XecdClient(
|
||||
account_id=os.environ["XE_ACCOUNT_ID"],
|
||||
|
|
@ -29,6 +36,7 @@ def run_xe_healthcheck():
|
|||
and ("package" in account_info_response.keys()),
|
||||
)
|
||||
if not contains_good_response_fields:
|
||||
logger.error("Didn't find the fields of a good response.")
|
||||
raise ConnectionError("Response from xe.com is not successful.")
|
||||
|
||||
logger.info("xe.com reached successfully.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue