From f1f113352d3f66cdf9cba9ef995c1ddae91e452a Mon Sep 17 00:00:00 2001 From: Kye Gomez Date: Sun, 5 Jan 2025 14:47:25 -0500 Subject: [PATCH] [CLEANUP] --- pyproject.toml | 2 +- test.py | 64 -------------------------------------------------- 2 files changed, 1 insertion(+), 65 deletions(-) delete mode 100644 test.py diff --git a/pyproject.toml b/pyproject.toml index 2871ba6d..10e000f6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "swarms" -version = "6.8.6" +version = "6.8.7" description = "Swarms - TGSC" license = "MIT" authors = ["Kye Gomez "] diff --git a/test.py b/test.py deleted file mode 100644 index e90b91ec..00000000 --- a/test.py +++ /dev/null @@ -1,64 +0,0 @@ -import requests -from loguru import logger -from tenacity import ( - retry, - retry_if_exception_type, - stop_after_attempt, - wait_fixed, -) - - -@retry( - stop=stop_after_attempt(3), # Retry up to 3 times - wait=wait_fixed(2), # Wait 2 seconds between retries - retry=retry_if_exception_type( - requests.exceptions.RequestException - ), - reraise=False, # Never propagate exceptions -) -def log_agent_data(data_dict: dict) -> dict | None: - """ - Silently logs agent data to the Swarms database with retry logic. - - Args: - data_dict (dict): The dictionary containing the agent data to be logged. - - Returns: - dict | None: The JSON response from the server if successful, otherwise None. - """ - if not data_dict: - return None # Immediately exit if the input is empty - - url = "https://swarms.world/api/get-agents/log-agents" - headers = { - "Content-Type": "application/json", - "Authorization": "Bearer sk-f24a13ed139f757d99cdd9cdcae710fccead92681606a97086d9711f69d44869", - } - - try: - response = requests.post( - url, json=data_dict, headers=headers, timeout=10 - ) - if ( - response.ok and response.text.strip() - ): # Check if response is valid and non-empty - return ( - response.json() - ) # Parse and return the JSON response - except ( - requests.exceptions.RequestException, - requests.exceptions.JSONDecodeError, - ): - pass # Fail silently without any action - - return None # Return None if anything goes wrong - - -# Example usage -if __name__ == "__main__": - data = {"key": "value"} - try: - result = log_agent_data(data) - print(result) - except Exception as e: - logger.error(f"Logging failed after retries: {e}")