(20250121) Safety push...

This commit is contained in:
2025-01-21 15:27:10 +05:30
parent 96bb5768da
commit f94d9e1a4b
9 changed files with 1428 additions and 25 deletions
@@ -196,30 +196,6 @@ class AsyncNimbusWhatsapp:
response_json = api_response.json()
)
# print("HTTP CODE:", api_response.status_code)
# print("RAW CONTENT:", api_response.content)
# api_json = api_response.json()
# print("API JSON:", api_json)
# print("API JSON:", json.to_string(api_json, default=str))
# # For a successful API call:
# if api_response.status_code in [200]:
# api_json = api_response.json()
# print(api_json)
# # summary.rawResponse = api_json
# # print (summary.rawResponse)
#
# first_response = api_json
# first_desc = first_response.get("status", "N/A").lower().strip()
# summary.success = True if first_desc == "success" else False
# if summary.success:
# summary.messageId = first_response.get("requestid")
# else:
# summary.message = first_response.get("status")
# print (summary)
# # For any other code that indicates some form of failure:
# else: summary.rawResponse = api_response.content.decode()
# If something goes wrong along the way:
except Exception as exception:
self.__printer(exception)
@@ -215,7 +215,11 @@ class NimbusWhatsappSendMessageResponse(BaseModel):
if self.image1Url: api_input["img2"] = self.image1Url
# Add the scheduled delivery time:
if self.scheduleTs: api_input["scheduleon"] = self.scheduleTs
if self.scheduleTs:
api_input["scheduleon"] = date_time.to_timezone(
datetime_object = self.scheduleTs,
timezone = date_time.TIMEZONE_IST
).strftime("%Y%m%d%H%M")
# Done here:
return api_input