Update whatsapp_client.py
Browse files- whatsapp_client.py +3 -2
whatsapp_client.py
CHANGED
|
@@ -87,11 +87,12 @@ def _send_via_proxy(recipient_id: str, message_data: Dict[str, Any]) -> bool:
|
|
| 87 |
"""POST to Cloudflare Worker /send — worker relays to graph.facebook.com."""
|
| 88 |
url = f"{_PROXY_URL}/send"
|
| 89 |
try:
|
| 90 |
-
|
|
|
|
|
|
|
| 91 |
url,
|
| 92 |
json={"recipient_id": recipient_id, "message_data": message_data},
|
| 93 |
timeout=30,
|
| 94 |
-
verify=certifi.where(),
|
| 95 |
headers={"Content-Type": "application/json"},
|
| 96 |
)
|
| 97 |
resp.raise_for_status()
|
|
|
|
| 87 |
"""POST to Cloudflare Worker /send — worker relays to graph.facebook.com."""
|
| 88 |
url = f"{_PROXY_URL}/send"
|
| 89 |
try:
|
| 90 |
+
# Use _session (not requests.post) so the socket-level DNS patch
|
| 91 |
+
# applies — HF cannot resolve .workers.dev via system DNS.
|
| 92 |
+
resp = _session.post(
|
| 93 |
url,
|
| 94 |
json={"recipient_id": recipient_id, "message_data": message_data},
|
| 95 |
timeout=30,
|
|
|
|
| 96 |
headers={"Content-Type": "application/json"},
|
| 97 |
)
|
| 98 |
resp.raise_for_status()
|