Merge commit '8c53cd751261a9c46177fd509aa49d591dd4bcf2'

This commit is contained in:
2025-09-30 14:14:17 +05:30
3 changed files with 17 additions and 3 deletions
@@ -199,6 +199,7 @@ class AsyncNimbusSMS:
# Construct the basic structure of the response of this method: # Construct the basic structure of the response of this method:
summary = SentSMSMessageModel( summary = SentSMSMessageModel(
client = "nimbusSmsIndia",
sender = {"senderId": self.__sender_id}, sender = {"senderId": self.__sender_id},
recipient = {"recipientNo": recipient_number}, recipient = {"recipientNo": recipient_number},
text = message, text = message,
+5
View File
@@ -79,6 +79,11 @@ import datetime
class SentSMSMessageModel(BaseModel): class SentSMSMessageModel(BaseModel):
client: str = Field(
description = "The name of the client (service) that was used.",
frozen = True
)
ts: AwareDatetime = Field( ts: AwareDatetime = Field(
description = "the time (utc) at which this message was sent by the sender", description = "the time (utc) at which this message was sent by the sender",
frozen = True, frozen = True,
+11 -3
View File
@@ -35,6 +35,9 @@ import sys
sys.path.append(".") sys.path.append(".")
sys.path.append("..") sys.path.append("..")
# System-level activities:
import io
# To check certs through cryptographic algorithms: # To check certs through cryptographic algorithms:
from cryptography import x509 from cryptography import x509
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.backends import default_backend
@@ -204,7 +207,7 @@ class CertExpiryCheck:
# ┃ ┏┓┏┏┓┃ ┃ ┏┓┏┓╋┏ # ┃ ┏┓┏┏┓┃ ┃ ┏┓┏┓╋┏
# ┗┛┗┛┗┗┻┗ ┗┛┗ ┛ ┗┛ # ┗┛┗┛┗┗┻┗ ┗┛┗ ┛ ┗┛
def load_local(self, path: str) -> bool: def load_local(self, path: str | io.BytesIO) -> bool:
""" """
Loads a certificate stored on a local file path and checks for its validity. Loads a certificate stored on a local file path and checks for its validity.
@@ -221,8 +224,13 @@ class CertExpiryCheck:
try: try:
# Read the contents of the certificate file: # Read the contents of the certificate file:
with open(path, 'rb') as f: if isinstance(path, str):
cert_data = f.read() with open(path, 'rb') as f:
cert_data = f.read()
elif isinstance(path, io.BytesIO):
path.seek(0)
cert_data = path.read()
else: cert_data = None
# Load the certificate: # Load the certificate:
cert = x509.load_pem_x509_certificate(cert_data, default_backend()) cert = x509.load_pem_x509_certificate(cert_data, default_backend())