This commit is contained in:
parent
9c7b477bd4
commit
45604b5797
@ -4,6 +4,7 @@ sqlalchemy>=2.0.23
|
|||||||
psycopg2-binary>=2.9.9
|
psycopg2-binary>=2.9.9
|
||||||
pydantic[email]>=2.5.0
|
pydantic[email]>=2.5.0
|
||||||
httpx>=0.25.2
|
httpx>=0.25.2
|
||||||
|
certifi>=2024.0.0
|
||||||
python-dotenv>=1.0.0
|
python-dotenv>=1.0.0
|
||||||
python-multipart>=0.0.7
|
python-multipart>=0.0.7
|
||||||
openpyxl>=3.1.2
|
openpyxl>=3.1.2
|
||||||
|
|||||||
@ -3,7 +3,9 @@ WhatsApp Cloud API Service
|
|||||||
Handles sending WhatsApp messages via Meta's API
|
Handles sending WhatsApp messages via Meta's API
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
import ssl
|
||||||
import httpx
|
import httpx
|
||||||
|
import certifi
|
||||||
import re
|
import re
|
||||||
import logging
|
import logging
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
@ -164,7 +166,8 @@ class WhatsAppService:
|
|||||||
url = f"{self.base_url}/{self.phone_number_id}/messages"
|
url = f"{self.base_url}/{self.phone_number_id}/messages"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with httpx.AsyncClient() as client:
|
ssl_ctx = ssl.create_default_context(cafile=certifi.where())
|
||||||
|
async with httpx.AsyncClient(verify=ssl_ctx) as client:
|
||||||
response = await client.post(
|
response = await client.post(
|
||||||
url,
|
url,
|
||||||
json=payload,
|
json=payload,
|
||||||
@ -294,7 +297,8 @@ class WhatsAppService:
|
|||||||
print("=" * 80 + "\n")
|
print("=" * 80 + "\n")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
async with httpx.AsyncClient() as client:
|
ssl_ctx = ssl.create_default_context(cafile=certifi.where())
|
||||||
|
async with httpx.AsyncClient(verify=ssl_ctx) as client:
|
||||||
response = await client.post(
|
response = await client.post(
|
||||||
url,
|
url,
|
||||||
json=payload,
|
json=payload,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user