From 1c884b67ddd38479823cf183cd97e8f923341313 Mon Sep 17 00:00:00 2001 From: Berack96 Date: Wed, 1 Oct 2025 21:31:43 +0200 Subject: [PATCH] fix: environment variable assertions --- src/app.py | 2 +- src/app/markets/coinbase.py | 4 ++-- src/app/markets/cryptocompare.py | 2 +- src/app/news/news_api.py | 2 +- src/app/social/reddit.py | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app.py b/src/app.py index 8477149..ec6d712 100644 --- a/src/app.py +++ b/src/app.py @@ -42,6 +42,6 @@ if __name__ == "__main__": analyze_btn = gr.Button("🔎 Analizza") analyze_btn.click(fn=pipeline.interact, inputs=[user_input], outputs=output) - server, port = ("0.0.0.0", 8000) + server, port = ("127.0.0.1", 8000) log_info(f"Starting UPO AppAI on http://{server}:{port}") demo.launch(server_name=server, server_port=port, quiet=True) diff --git a/src/app/markets/coinbase.py b/src/app/markets/coinbase.py index 9e4c64d..ea944e4 100644 --- a/src/app/markets/coinbase.py +++ b/src/app/markets/coinbase.py @@ -49,10 +49,10 @@ class CoinBaseWrapper(BaseWrapper): def __init__(self, currency: str = "USD"): api_key = os.getenv("COINBASE_API_KEY") - assert api_key is not None, "API key is required" + assert api_key, "COINBASE_API_KEY environment variable not set" api_private_key = os.getenv("COINBASE_API_SECRET") - assert api_private_key is not None, "API private key is required" + assert api_private_key, "COINBASE_API_SECRET environment variable not set" self.currency = currency self.client: RESTClient = RESTClient( diff --git a/src/app/markets/cryptocompare.py b/src/app/markets/cryptocompare.py index 98e5284..2986b33 100644 --- a/src/app/markets/cryptocompare.py +++ b/src/app/markets/cryptocompare.py @@ -34,7 +34,7 @@ class CryptoCompareWrapper(BaseWrapper): """ def __init__(self, currency:str='USD'): api_key = os.getenv("CRYPTOCOMPARE_API_KEY") - assert api_key is not None, "API key is required" + assert api_key, "CRYPTOCOMPARE_API_KEY environment variable not set" self.api_key = api_key self.currency = currency diff --git a/src/app/news/news_api.py b/src/app/news/news_api.py index 415fdac..6f62ef6 100644 --- a/src/app/news/news_api.py +++ b/src/app/news/news_api.py @@ -19,7 +19,7 @@ class NewsApiWrapper(NewsWrapper): def __init__(self): api_key = os.getenv("NEWS_API_KEY") - assert api_key is not None, "NEWS_API_KEY environment variable not set" + assert api_key, "NEWS_API_KEY environment variable not set" self.client = newsapi.NewsApiClient(api_key=api_key) self.category = "business" # Cryptocurrency is under business diff --git a/src/app/social/reddit.py b/src/app/social/reddit.py index 6028010..e0b4928 100644 --- a/src/app/social/reddit.py +++ b/src/app/social/reddit.py @@ -51,10 +51,10 @@ class RedditWrapper(SocialWrapper): def __init__(self): client_id = os.getenv("REDDIT_API_CLIENT_ID") - assert client_id is not None, "REDDIT_API_CLIENT_ID environment variable is not set" + assert client_id, "REDDIT_API_CLIENT_ID environment variable is not set" client_secret = os.getenv("REDDIT_API_CLIENT_SECRET") - assert client_secret is not None, "REDDIT_API_CLIENT_SECRET environment variable is not set" + assert client_secret, "REDDIT_API_CLIENT_SECRET environment variable is not set" self.tool = Reddit( client_id=client_id,