result management
This commit is contained in:
@@ -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"}
|
||||||
|
|||||||
Reference in New Issue
Block a user