(20250102) Safaricom M-Pesa work.

This commit is contained in:
2025-01-02 08:00:18 +00:00
parent a02b34aeaa
commit 2f563b2a0e
8 changed files with 545 additions and 17 deletions
@@ -101,6 +101,7 @@ http_client = httpx.Client(
# For debugging:
printer = IceCreamDebugger(prefix = "Tick-In (Sful) | ", includeContext = True)
no_context_printer = IceCreamDebugger(prefix = "Tick-In (Sful) | ", includeContext = False)
# *****************************************************************************************************************
@@ -170,8 +171,8 @@ def ticks_to_kafka(ticks: List[TradingTick]) -> int:
else: failure_count += 1
# Debugging print:
ticks_str = f"TICKS: {total_count:6,} | PRODUCED: {success_count:6,} | TOTAL: {TOTAL_TICK_COUNT:12,}"
printer(ticks_str)
ticks_str = f"| TICKS: {total_count:6,} | PRDC'D: {success_count:6,} | TOT: {TOTAL_TICK_COUNT:10,} |"
no_context_printer(ticks_str)
# Done here:
return success_count
@@ -365,6 +366,14 @@ def init(
debug: bool
) -> bool:
"""
To initialize all credentials, instances, and connectivity for this whole script.
:param script_id: The id to use to load cred and data from the internal service.
:param token_key: The key to identify the auth-token that must be used for connecting to the data feed.
:param debug: Whether, or not, you would like to print the debug messages.
:return: True if initialized successfully, else False.
"""
# Declare the required global variables:
global TOKEN_KEY
global AUTH_TOKEN
@@ -461,7 +470,7 @@ def init(
if not AUTH_TOKEN:
print("FATAL: AUTH-TOKEN FETCHING FAILED!")
return False
printer("Aut-token fetched.")
printer("Auth-token fetched.")
# ┳┓ ┏┓ ┓
# ┃┃┏┓╋┏┓━━┣ ┏┓┏┓┏┫