MCPcopy Create free account
hub / github.com/TheSecuredAnalyst/security-suite / test_connection

Method test_connection

modules/siem/webhook.py:227–251  ·  view source on GitHub ↗

Test webhook endpoint. Returns: True if reachable

(self)

Source from the content-addressed store, hash-verified

225 async def test_connection(self) -> bool:
226 """Test webhook endpoint.
227
228 Returns:
229 True if reachable
230 """
231 try:
232 async with httpx.AsyncClient(timeout=self.timeout) as client:
233 # Send a test/ping request
234 if self.format == "slack":
235 # Slack accepts empty payload for testing
236 response = await client.post(
237 self.url,
238 json={"text": "Security Suite connection test"},
239 headers=self._get_headers(),
240 )
241 else:
242 # Just check if endpoint is reachable
243 response = await client.head(self.url)
244
245 return response.status_code < 500
246
247 except Exception as e:
248 self.logger.error(f"Webhook test failed: {e}")
249 return False
250
251 def get_config_info(self) -> dict:
252 """Get exporter configuration info."""
253 return {
254 "type": "webhook",

Callers 1

runFunction · 0.95

Calls 3

_get_headersMethod · 0.95
postMethod · 0.80
headMethod · 0.80

Tested by

no test coverage detected