From 655408536ca336fcbcc1d0530f1db3de2dafb070 Mon Sep 17 00:00:00 2001 From: LottR079 Date: Mon, 15 Dec 2025 20:57:24 +0100 Subject: [PATCH] feat: add environment check helper Added a check_env.py script that checks for key environment variables before running Kalshi examples. --- check_env.py | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 check_env.py diff --git a/check_env.py b/check_env.py new file mode 100644 index 0000000..f31e67c --- /dev/null +++ b/check_env.py @@ -0,0 +1,54 @@ +```py +""" +Simple helper to verify that environment variables required for +Kalshi starter code are present. + +Usage: + python check_env.py +""" + +import os +import textwrap + + +REQUIRED_VARS = [ + "KALSHI_API_KEY", + "KALSHI_API_SECRET", + "KALSHI_ENV", # e.g. "demo" or "prod" +] + + +def main() -> None: + print("Checking Kalshi environment variables...\n") + + missing = [] + for name in REQUIRED_VARS: + value = os.getenv(name) + if value: + print(f"✅ {name} is set (hidden)") + else: + print(f"⚠️ {name} is NOT set") + missing.append(name) + + if missing: + print("\nSome variables are missing:") + for name in missing: + print(f" - {name}") + + print( + "\nYou can export them before running the starter code, e.g.:\n" + ) + example = textwrap.dedent( + """ + export KALSHI_API_KEY=your_api_key_here + export KALSHI_API_SECRET=your_secret_here + export KALSHI_ENV=demo + """ + ).strip() + print(example) + else: + print("\nAll required variables appear to be set. ✅") + + +if __name__ == "__main__": + main()