From fb5ff1a4fee524df0d8c43e79bfa4e96a32aea77 Mon Sep 17 00:00:00 2001 From: Ashutosh singh <55102089+Ashutosh619-sudo@users.noreply.github.com> Date: Mon, 14 Oct 2024 15:34:43 +0530 Subject: [PATCH] fix: Revert changes (#399) * Revert "feat: Add middleware to log all post requests (#397)" This reverts commit 71f918a2bda99aada80d34f95bb62dfdd534d719. * Revert "feat: Added loggers in sdk and changed version (#398)" This reverts commit f1a84c81327a9036074b28d0eba806a269a72a08. --- fyle_xero_api/logging_middleware.py | 20 -------------------- fyle_xero_api/settings.py | 6 ------ requirements.txt | 4 ++-- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/fyle_xero_api/logging_middleware.py b/fyle_xero_api/logging_middleware.py index 8d1c65b9..9fb5391b 100644 --- a/fyle_xero_api/logging_middleware.py +++ b/fyle_xero_api/logging_middleware.py @@ -1,4 +1,3 @@ -import json import logging import traceback @@ -26,22 +25,3 @@ def process_exception(self, request, exception): logger.error(str(message).replace("\n", "")) return HttpResponse("Error processing the request.", status=500) - - -class LogPostRequestMiddleware: - def __init__(self, get_response): - self.get_response = get_response - - def __call__(self, request): - if request.method in ['POST', 'PUT']: - try: - body_unicode = request.body.decode('utf-8') - request_body = json.loads(body_unicode) - logger.info("POST request to %s: %s", request.path, request_body) - except (json.JSONDecodeError, UnicodeDecodeError): - logger.warning("Failed to decode POST request body for %s", request.path) - except Exception as e: - logger.info('Something went wrong when logging post call - %s', e) - - response = self.get_response(request) - return response diff --git a/fyle_xero_api/settings.py b/fyle_xero_api/settings.py index f7e0ab72..b21b5047 100644 --- a/fyle_xero_api/settings.py +++ b/fyle_xero_api/settings.py @@ -60,7 +60,6 @@ MIDDLEWARE = [ "request_logging.middleware.LoggingMiddleware", "fyle_xero_api.logging_middleware.ErrorHandlerMiddleware", - "fyle_xero_api.logging_middleware.LogPostRequestMiddleware", "corsheaders.middleware.CorsMiddleware", "django.middleware.common.CommonMiddleware", "corsheaders.middleware.CorsPostCsrfMiddleware", @@ -201,11 +200,6 @@ "handlers": ["debug_logs"], "propagate": True }, - 'xerosdk.apis.api_base': { - 'handlers': ['console'], - 'level': 'INFO', - 'propagate': True - }, }, } diff --git a/requirements.txt b/requirements.txt index f8b93c4b..b81bcd5a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ djangorestframework==3.11.2 django-sendgrid-v5==1.2.0 enum34==1.1.10 future==0.18.2 -fyle==0.37.2 +fyle==0.37.0 fyle-accounting-mappings==1.34.8 fyle-integrations-platform-connector==1.38.4 fyle-rest-auth==1.7.2 @@ -41,7 +41,7 @@ Unidecode==1.1.2 urllib3==1.26.11 wcwidth==0.1.8 wrapt==1.12.1 -xerosdk==0.14.2 +xerosdk==0.14.1 pytest==7.1.2 pytest-cov==3.0.0 pytest-django==4.5.2