Se modificaron tareas asincronas
This commit is contained in:
@@ -14,11 +14,18 @@ class SOAPController:
|
||||
self.base_url = settings.SOAP_SERVICE_URL
|
||||
self.timeout = settings.TIMEOUT # Timeout por default
|
||||
|
||||
import ssl
|
||||
# Contexto SSL personalizado para permitir claves DH pequeñas
|
||||
ssl_context = ssl.create_default_context()
|
||||
ssl_context.set_ciphers('DEFAULT@SECLEVEL=1')
|
||||
ssl_context.check_hostname = False
|
||||
ssl_context.verify_mode = ssl.CERT_NONE
|
||||
|
||||
async def make_request(self, endpoint, data=None, headers=None, max_retries=5):
|
||||
intento = 0
|
||||
while intento < settings.MAX_RETRIES:
|
||||
try:
|
||||
with httpx.Client(verify=settings.context, timeout=self.timeout) as client:
|
||||
with httpx.Client(verify=self.ssl_context, timeout=self.timeout) as client:
|
||||
content = data.encode('utf-8') if data else None
|
||||
response = client.post(
|
||||
f"{self.base_url}/{endpoint}",
|
||||
@@ -53,7 +60,7 @@ class SOAPController:
|
||||
intento = 0
|
||||
while intento < settings.MAX_RETRIES:
|
||||
try:
|
||||
async with httpx.AsyncClient(verify=settings.context, timeout=self.timeout) as client:
|
||||
async with httpx.AsyncClient(verify=self.ssl_context, timeout=self.timeout) as client:
|
||||
content = data.encode('utf-8') if data else None
|
||||
response = await client.post(
|
||||
f"{self.base_url}/{endpoint}",
|
||||
|
||||
Reference in New Issue
Block a user