From 9f90dc4a18a5fd099ab3f4dee9e78309afbed703 Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Wed, 9 Jul 2025 09:57:50 -0600 Subject: [PATCH 1/2] added logger --- polyapi/execute.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/polyapi/execute.py b/polyapi/execute.py index 789344d..5d75048 100644 --- a/polyapi/execute.py +++ b/polyapi/execute.py @@ -1,10 +1,13 @@ from typing import Dict, Optional import requests import os +import logging from requests import Response from polyapi.config import get_api_key_and_url, get_mtls_config from polyapi.exceptions import PolyApiException +logger = logging.getLogger("poly") + def direct_execute(function_type, function_id, data) -> Response: """ execute a specific function id/type """ @@ -46,7 +49,7 @@ def direct_execute(function_type, function_id, data) -> Response: if (resp.status_code < 200 or resp.status_code >= 300): error_content = resp.content.decode("utf-8", errors="ignore") if function_type == 'api' and os.getenv("LOGS_ENABLED"): - raise PolyApiException(f"Error executing api function with id: {function_id}. Status code: {resp.status_code}. Request data: {data}, Response: {error_content}") + logger.error(f"Error executing api function with id: {function_id}. Status code: {resp.status_code}. Request data: {data}, Response: {error_content}") elif function_type != 'api': raise PolyApiException(f"{resp.status_code}: {error_content}") @@ -70,7 +73,7 @@ def execute(function_type, function_id, data) -> Response: if (resp.status_code < 200 or resp.status_code >= 300) and os.getenv("LOGS_ENABLED"): error_content = resp.content.decode("utf-8", errors="ignore") if function_type == 'api' and os.getenv("LOGS_ENABLED"): - raise PolyApiException(f"Error executing api function with id: {function_id}. Status code: {resp.status_code}. Request data: {data}, Response: {error_content}") + logger.error(f"Error executing api function with id: {function_id}. Status code: {resp.status_code}. Request data: {data}, Response: {error_content}") elif function_type != 'api': raise PolyApiException(f"{resp.status_code}: {error_content}") From d5f78053eda36b8642ac47b6658113dd2750d52b Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Wed, 9 Jul 2025 13:19:33 -0600 Subject: [PATCH 2/2] bumped version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 599046d..cf5b8ca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"] [project] name = "polyapi-python" -version = "0.3.9.dev5" +version = "0.3.9.dev6" description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers" authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }] dependencies = [