result management

This commit is contained in:
CHIEFSOFT\ameye
2025-04-05 21:44:33 -04:00
parent e7ae1f6732
commit 7cbe3aefea
+6 -3
View File
@@ -35,7 +35,6 @@ class SimbrellaIntegration:
} }
logger.error(f"This is PayLoad: {str(payload)}",exc_info=True) logger.error(f"This is PayLoad: {str(payload)}",exc_info=True)
# auth = HTTPBasicAuth(settings.VALID_APP_ID, settings.VALID_API_KEY)
headers = { headers = {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'x-api-key': f'{settings.VALID_API_KEY}', 'x-api-key': f'{settings.VALID_API_KEY}',
@@ -43,14 +42,18 @@ class SimbrellaIntegration:
} }
try: try:
response = requests.post(url, json=payload, timeout=10, headers=headers) response = requests.post(url, json=payload, timeout=10, headers=headers)
logger.error(f"This is Response: {str(response)}", exc_info=True) logger.error(f"This is Response: {str(response)}", exc_info=True)
# Raise an error for non-200 responses # Raise an error for non-200 responses
if response.status_code != 200: if response.status_code != 200:
response.raise_for_status() response.raise_for_status()
return response.json() result = {
'response': response,
'status': response.status_code
}
return result.json()
except requests.exceptions.RequestException as err: except requests.exceptions.RequestException as err:
logger.error(f"RACCheck API call failed: {str(err)}", exc_info=True) logger.error(f"RACCheck API call failed: {str(err)}", exc_info=True)
return {"error": "RACCheck API error"} return {"error": "RACCheck API error"}