Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Dec 29, 2023
1 parent e55132e commit e66306f
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions .github/actions/python/send-email/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@


def get_settings():
"""_summary_
"""Gets the general settings from environment variables. Variables are
parsed to the correct type.
Returns:
_description_
A tuple with the values (region, auth, timeout).
"""

region = os.getenv("REGION", "")
assert region != "", "Region path parameter not set."
raise Exception(region)

auth = os.getenv("AUTH", "")
assert auth != "", "Authorization header not set."
Expand All @@ -37,10 +39,11 @@ def get_settings():


def get_json_body() -> JsonBody:
"""_summary_
"""Gets the JSON body from environment variables. Variables are parsed to
the correct type.
Returns:
_description_
A dictionary containing the request's JSON body.
"""

body: JsonBody = {}
Expand Down Expand Up @@ -107,13 +110,13 @@ def set_value(env_key: str, body_key: str, required: bool):


def send_email(region: str, auth: str, timeout: int, body: JsonBody):
"""_summary_
"""Sends the email.
Args:
region: _description_
auth: _description_
timeout: _description_
body: _description_
region: The API region to use.
auth: The authorization header used to authenticate with the API.
timeout: The number of seconds to wait before the request times out.
body: The request's JSON body.
"""

response = requests.post(
Expand All @@ -130,9 +133,7 @@ def send_email(region: str, auth: str, timeout: int, body: JsonBody):


def main():
"""Entry point"""

raise Exception("abc")
"""Entry point."""

region, auth, timeout = get_settings()
body = get_json_body()
Expand Down

0 comments on commit e66306f

Please sign in to comment.