This commit is contained in:
parent
e4fb9cf62f
commit
d9cdddb8c8
@ -3,7 +3,6 @@ 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 certifi
|
||||||
import re
|
import re
|
||||||
@ -167,8 +166,7 @@ class WhatsAppService:
|
|||||||
url = f"{self.base_url}/{self.phone_number_id}/messages"
|
url = f"{self.base_url}/{self.phone_number_id}/messages"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ssl_ctx = ssl.create_default_context(cafile=certifi.where())
|
async with httpx.AsyncClient(verify=certifi.where()) as client:
|
||||||
async with httpx.AsyncClient(verify=ssl_ctx) as client:
|
|
||||||
response = await client.post(
|
response = await client.post(
|
||||||
url,
|
url,
|
||||||
json=payload,
|
json=payload,
|
||||||
@ -298,8 +296,7 @@ class WhatsAppService:
|
|||||||
print("=" * 80 + "\n")
|
print("=" * 80 + "\n")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ssl_ctx = ssl.create_default_context(cafile=certifi.where())
|
async with httpx.AsyncClient(verify=certifi.where()) as client:
|
||||||
async with httpx.AsyncClient(verify=ssl_ctx) as client:
|
|
||||||
response = await client.post(
|
response = await client.post(
|
||||||
url,
|
url,
|
||||||
json=payload,
|
json=payload,
|
||||||
@ -548,8 +545,7 @@ class WhatsAppService:
|
|||||||
|
|
||||||
url = f"{self.base_url}/{self.phone_number_id}/messages"
|
url = f"{self.base_url}/{self.phone_number_id}/messages"
|
||||||
try:
|
try:
|
||||||
ssl_ctx = ssl.create_default_context(cafile=certifi.where())
|
async with httpx.AsyncClient(verify=certifi.where()) as client:
|
||||||
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