dhisana 0.0.1.dev225__py3-none-any.whl → 0.0.1.dev226__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -810,6 +810,76 @@ async def test_clay(api_key: str, webhook: str) -> Dict[str, Any]:
810
810
  logger.error(f"Clay test failed: {exc}")
811
811
  return {"success": False, "status_code": 0, "error_message": str(exc)}
812
812
 
813
+ ###############################################################################
814
+ # POSTHOG CONNECTIVITY TEST
815
+ ###############################################################################
816
+
817
+ async def test_posthog(
818
+ api_host: str,
819
+ project_id: str,
820
+ personal_api_key: str,
821
+ ) -> Dict[str, Any]:
822
+ """
823
+ Validate PostHog connectivity by issuing a lightweight HogQL query.
824
+
825
+ Requires:
826
+ • api_host (e.g. https://app.posthog.com or self-hosted URL)
827
+ • project_id (numeric or string project identifier)
828
+ • personal_api_key (token with query access)
829
+ """
830
+ base_url = (api_host or "").rstrip("/")
831
+ if not base_url:
832
+ return {
833
+ "success": False,
834
+ "status_code": 0,
835
+ "error_message": "Missing api_host for PostHog connectivity test.",
836
+ }
837
+ if not project_id:
838
+ return {
839
+ "success": False,
840
+ "status_code": 0,
841
+ "error_message": "Missing project_id for PostHog connectivity test.",
842
+ }
843
+ if not personal_api_key:
844
+ return {
845
+ "success": False,
846
+ "status_code": 0,
847
+ "error_message": "Missing personal_api_key for PostHog connectivity test.",
848
+ }
849
+
850
+ url = f"{base_url}/api/projects/{project_id}/query/"
851
+ headers = {
852
+ "Authorization": f"Bearer {personal_api_key}",
853
+ "Content-Type": "application/json",
854
+ }
855
+ payload = {"query": {"kind": "HogQLQuery", "query": "SELECT 1"}}
856
+
857
+ try:
858
+ async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=10)) as session:
859
+ async with session.post(url, headers=headers, json=payload) as response:
860
+ status = response.status
861
+ data = await safe_json(response)
862
+
863
+ if status == 200:
864
+ return {"success": True, "status_code": status, "error_message": None}
865
+
866
+ detail = None
867
+ if isinstance(data, dict):
868
+ detail = (
869
+ data.get("message")
870
+ or data.get("detail")
871
+ or data.get("error")
872
+ or data.get("code")
873
+ )
874
+ return {
875
+ "success": False,
876
+ "status_code": status,
877
+ "error_message": detail or f"PostHog responded with {status}",
878
+ }
879
+ except Exception as exc:
880
+ logger.error(f"PostHog connectivity test failed: {exc}")
881
+ return {"success": False, "status_code": 0, "error_message": str(exc)}
882
+
813
883
  ###############################################################################
814
884
  # MCP SERVER CONNECTIVITY TEST
815
885
  ###############################################################################
@@ -1358,6 +1428,7 @@ async def test_connectivity(tool_config: List[Dict[str, Any]]) -> Dict[str, Dict
1358
1428
  "youtube": test_youtube,
1359
1429
  "salesforce": test_salesforce,
1360
1430
  "clay": test_clay,
1431
+ "posthog": test_posthog,
1361
1432
  "mcpServer": test_mcp_server,
1362
1433
  "slack": test_slack,
1363
1434
  "mailgun": test_mailgun,
@@ -1479,6 +1550,28 @@ async def test_connectivity(tool_config: List[Dict[str, Any]]) -> Dict[str, Dict
1479
1550
  results[tool_name] = await test_mailgun(api_key, domain)
1480
1551
  continue
1481
1552
 
1553
+ # ------------------------------------------------------------------ #
1554
+ # Special-case: PostHog (needs host + project id + personal API key)
1555
+ # ------------------------------------------------------------------ #
1556
+ if tool_name == "posthog":
1557
+ api_host = next((c["value"] for c in config_entries if c["name"] == "api_host"), None)
1558
+ project_id = next((c["value"] for c in config_entries if c["name"] == "project_id"), None)
1559
+ personal_api_key = next(
1560
+ (c["value"] for c in config_entries if c["name"] in ("personal_api_key", "personalApiKey")),
1561
+ None,
1562
+ )
1563
+
1564
+ if not api_host or not project_id or not personal_api_key:
1565
+ results[tool_name] = {
1566
+ "success": False,
1567
+ "status_code": 0,
1568
+ "error_message": "Missing api_host, project_id, or personal_api_key for PostHog.",
1569
+ }
1570
+ else:
1571
+ logger.info("Testing connectivity for PostHog…")
1572
+ results[tool_name] = await test_posthog(api_host, project_id, personal_api_key)
1573
+ continue
1574
+
1482
1575
  # ------------------------------------------------------------------ #
1483
1576
  # Special-case: Salesforce (requires credentials)
1484
1577
  # ------------------------------------------------------------------ #
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dhisana
3
- Version: 0.0.1.dev225
3
+ Version: 0.0.1.dev226
4
4
  Summary: A Python SDK for Dhisana AI Platform
5
5
  Home-page: https://github.com/dhisana-ai/dhisana-python-sdk
6
6
  Author: Admin
@@ -78,7 +78,7 @@ dhisana/utils/serperdev_google_jobs.py,sha256=m5_2f_5y79FOFZz1A_go6m0hIUfbbAoZ0Y
78
78
  dhisana/utils/serperdev_local_business.py,sha256=JoZfTg58Hojv61cyuwA2lcnPdLT1lawnWaBNrUYWnuQ,6447
79
79
  dhisana/utils/serperdev_search.py,sha256=_iBKIfHMq4gFv5StYz58eArriygoi1zW6VnLlux8vto,9363
80
80
  dhisana/utils/smtp_email_tools.py,sha256=kx0VSa0JQyVLD020oARCHhOBZJxDwMIri1Z7jPN0nP4,15843
81
- dhisana/utils/test_connect.py,sha256=AhaGFV1-E5YhzkWyDtXypuAeFxgB6tIBHAs5eSSL-6k,65210
81
+ dhisana/utils/test_connect.py,sha256=wkswcwEyMSVhZACHtqsZDhP6QpDMW4wq5MTcfRokvOM,69021
82
82
  dhisana/utils/trasform_json.py,sha256=s48DoyzVVCI4dTvSUwF5X-exX6VH6nPWrjbUENkYuNE,6979
83
83
  dhisana/utils/web_download_parse_tools.py,sha256=ouXwH7CmjcRjoBfP5BWat86MvcGO-8rLCmWQe_eZKjc,7810
84
84
  dhisana/utils/workflow_code_model.py,sha256=YPWse5vBb3O6Km2PvKh1Q3AB8qBkzLt1CrR5xOL9Mro,99
@@ -92,8 +92,8 @@ dhisana/workflow/agent.py,sha256=esv7_i_XuMkV2j1nz_UlsHov_m6X5WZZiZm_tG4OBHU,565
92
92
  dhisana/workflow/flow.py,sha256=xWE3qQbM7j2B3FH8XnY3zOL_QXX4LbTW4ArndnEYJE0,1638
93
93
  dhisana/workflow/task.py,sha256=HlWz9mtrwLYByoSnePOemBUBrMEcj7KbgNjEE1oF5wo,1830
94
94
  dhisana/workflow/test.py,sha256=kwW8jWqSBNcRmoyaxlTuZCMOpGJpTbJQgHI7gSjwdzM,3399
95
- dhisana-0.0.1.dev225.dist-info/METADATA,sha256=6HiYSMKHSzpFiCOi9WR4NpIqUMB3jxbnqJg3LC7tjEU,1190
96
- dhisana-0.0.1.dev225.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
97
- dhisana-0.0.1.dev225.dist-info/entry_points.txt,sha256=jujxteZmNI9EkEaK-pOCoWuBujU8TCevdkfl9ZcKHek,49
98
- dhisana-0.0.1.dev225.dist-info/top_level.txt,sha256=NETTHt6YifG_P7XtRHbQiXZlgSFk9Qh9aR-ng1XTf4s,8
99
- dhisana-0.0.1.dev225.dist-info/RECORD,,
95
+ dhisana-0.0.1.dev226.dist-info/METADATA,sha256=YmfqrcE8RzTAkcZzrVyJHN3-LOZpCcCTgbw8Lqq1wYA,1190
96
+ dhisana-0.0.1.dev226.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
97
+ dhisana-0.0.1.dev226.dist-info/entry_points.txt,sha256=jujxteZmNI9EkEaK-pOCoWuBujU8TCevdkfl9ZcKHek,49
98
+ dhisana-0.0.1.dev226.dist-info/top_level.txt,sha256=NETTHt6YifG_P7XtRHbQiXZlgSFk9Qh9aR-ng1XTf4s,8
99
+ dhisana-0.0.1.dev226.dist-info/RECORD,,