Spaces:
Running
Running
Download verify_webhook_endpoint.py from axeronis/microfunnel-api: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/verify_webhook_endpoint.py
- Command line
-
hf download hf://spaces/axeronis/microfunnel-api/verify_webhook_endpoint.py
-
curl -L -o verify_webhook_endpoint.py https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/verify_webhook_endpoint.py
1.41 kB
| import asyncio | |
| import httpx | |
| import uuid | |
| async def test_webhook(): | |
| # Use a valid UUID to avoid 422 if validation is strict | |
| tenant_id = str(uuid.uuid4()) | |
| url = f"http://localhost:8000/api/v1/webhook/evolution/{tenant_id}" | |
| print(f"Testing URL: {url}") | |
| try: | |
| async with httpx.AsyncClient() as client: | |
| # Send an empty JSON or minimal payload | |
| response = await client.post(url, json={"type": "test"}) | |
| print(f"Status Code: {response.status_code}") | |
| print(f"Response: {response.text}") | |
| if response.status_code == 404: | |
| print("β Endpoint NOT FOUND (404)") | |
| elif response.status_code == 405: | |
| print("β Method Not Allowed (405) - Check if POST is correct") | |
| elif response.status_code == 400: | |
| print("β Endpoint exists (400 Bad Request is expected for invalid payload)") | |
| elif response.status_code == 422: | |
| print("β Endpoint exists (422 validation error is expected)") | |
| elif response.status_code == 200: | |
| print("β Endpoint works!") | |
| else: | |
| print(f"β οΈ Unexpected status: {response.status_code}") | |
| except Exception as e: | |
| print(f"β Connection failed: {e}") | |
| if __name__ == "__main__": | |
| asyncio.run(test_webhook()) | |