Skip to content

Commit

Permalink
improve docstring and method name
Browse files Browse the repository at this point in the history
  • Loading branch information
grahamu committed Mar 28, 2024
1 parent d346c19 commit a583a5c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/sindri/sindri.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, api_key: str, verbose_level: int = 0, **kwargs):
self.max_polling_iterations: int = 172800 # 2 days with polling interval 1 second
self.perform_verify: bool = False

self._api_url = self._get_api_url_from_init_kwargs(**kwargs)
self._api_url = self._get_api_url(**kwargs)
self.set_api_key(api_key)

# With initial setup complete, set desired verbose level.
Expand All @@ -88,10 +88,12 @@ def __init__(self, api_key: str, verbose_level: int = 0, **kwargs):
print(f"Sindri API Url: {self._api_url}")
print(f"Sindri API Key: {self.api_key}\n")

def _get_api_url_from_init_kwargs(self, **kwargs) -> str:
"""Receive `kwargs` from `Sindri.__init__()` and return the API URL.
This examines `**kwargs` for `base_url` and `api_url`, in that order.
If neither are present, return the default API URL.
def _get_api_url(self, **kwargs) -> str:
"""Examine `**kwargs` for `base_url` and `api_url`, in that order.
If `base_url` is found and valid, return that. If not valid, raise an error.
If `base_url` is not found then check for `api_url`.
If `api_url` is found and valid, return that. If not valid, raise an error.
If neither keyword is found in `**kwargs`, return the default API URL.
"""

def is_url(url: str) -> bool:
Expand Down

0 comments on commit a583a5c

Please sign in to comment.