dhisana 0.0.1.dev253__py3-none-any.whl → 0.0.1.dev255__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.
@@ -1561,6 +1561,36 @@ async def test_dialpad(client_id: str, client_secret: str) -> Dict[str, Any]:
1561
1561
  return {"success": False, "status_code": 0, "error_message": str(exc)}
1562
1562
 
1563
1563
 
1564
+ async def test_twilio(account_sid: str, auth_token: str) -> Dict[str, Any]:
1565
+ """
1566
+ Validate Twilio credentials via a lightweight authenticated call.
1567
+ Uses HTTP Basic Auth (account_sid:auth_token) to fetch account info.
1568
+ """
1569
+ url = f"https://api.twilio.com/2010-04-01/Accounts/{account_sid}.json"
1570
+
1571
+ try:
1572
+ auth = aiohttp.BasicAuth(account_sid, auth_token)
1573
+ async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=10), auth=auth) as session:
1574
+ async with session.get(url) as response:
1575
+ status = response.status
1576
+ data = await safe_json(response)
1577
+
1578
+ if status == 200 and isinstance(data, dict) and "sid" in data:
1579
+ return {"success": True, "status_code": status, "error_message": None}
1580
+
1581
+ message = None
1582
+ if isinstance(data, dict):
1583
+ message = data.get("message") or data.get("error")
1584
+ return {
1585
+ "success": False,
1586
+ "status_code": status,
1587
+ "error_message": message or f"Twilio responded with {status}",
1588
+ }
1589
+ except Exception as exc:
1590
+ logger.error(f"Twilio connectivity test failed: {exc}")
1591
+ return {"success": False, "status_code": 0, "error_message": str(exc)}
1592
+
1593
+
1564
1594
  async def test_nooks(api_key: str) -> Dict[str, Any]:
1565
1595
  """
1566
1596
  Validate Nooks.ai API key via a simple authenticated call.
@@ -1714,6 +1744,82 @@ async def test_theorg(api_key: str) -> Dict[str, Any]:
1714
1744
  return {"success": False, "status_code": 0, "error_message": str(exc)}
1715
1745
 
1716
1746
 
1747
+ ###############################################################################
1748
+ # CORESIGNAL CONNECTIVITY
1749
+ ###############################################################################
1750
+
1751
+ async def test_coresignal(api_key: str) -> Dict[str, Any]:
1752
+ """
1753
+ Connectivity test for Coresignal using the Multi-source Jobs API search preview.
1754
+
1755
+ Uses a lightweight search query to verify API key validity.
1756
+ Reference: https://docs.coresignal.com/jobs-api/multi-source-jobs-api/search-preview
1757
+ """
1758
+ url = "https://api.coresignal.com/cdapi/v2/job_multi_source/search/es_dsl/preview"
1759
+ headers = {
1760
+ "apikey": api_key,
1761
+ "Accept": "application/json",
1762
+ "Content-Type": "application/json",
1763
+ }
1764
+ # Minimal query to check connectivity
1765
+ payload = {
1766
+ "query": {
1767
+ "bool": {
1768
+ "must": [
1769
+ {
1770
+ "match": {
1771
+ "title": "software engineer"
1772
+ }
1773
+ }
1774
+ ]
1775
+ }
1776
+ }
1777
+ }
1778
+
1779
+ try:
1780
+ timeout = aiohttp.ClientTimeout(total=15)
1781
+ async with aiohttp.ClientSession(timeout=timeout) as session:
1782
+ async with session.post(url, headers=headers, json=payload) as resp:
1783
+ status = resp.status
1784
+ data = await safe_json(resp)
1785
+
1786
+ if status == 200:
1787
+ # Check if we got a valid response (list of job results or empty list)
1788
+ if isinstance(data, list):
1789
+ return {"success": True, "status_code": status, "error_message": None}
1790
+ # Some endpoints may return a dict with results
1791
+ if isinstance(data, dict):
1792
+ if "error" in data or "errors" in data:
1793
+ err = data.get("error") or data.get("errors")
1794
+ if isinstance(err, dict):
1795
+ err = err.get("message") or str(err)
1796
+ return {"success": False, "status_code": status, "error_message": str(err)}
1797
+ return {"success": True, "status_code": status, "error_message": None}
1798
+ return {"success": True, "status_code": status, "error_message": None}
1799
+
1800
+ if status in (401, 403):
1801
+ msg = None
1802
+ if isinstance(data, dict):
1803
+ msg = data.get("message") or data.get("error") or data.get("detail")
1804
+ return {
1805
+ "success": False,
1806
+ "status_code": status,
1807
+ "error_message": msg or "Unauthorized – check Coresignal API key",
1808
+ }
1809
+
1810
+ msg = None
1811
+ if isinstance(data, dict):
1812
+ msg = data.get("message") or data.get("error") or data.get("detail")
1813
+ return {
1814
+ "success": False,
1815
+ "status_code": status,
1816
+ "error_message": msg or f"Coresignal responded with {status}",
1817
+ }
1818
+ except Exception as e:
1819
+ logger.error(f"Coresignal connectivity test failed: {e}")
1820
+ return {"success": False, "status_code": 0, "error_message": str(e)}
1821
+
1822
+
1717
1823
  ###############################################################################
1718
1824
  # DATAGMA CONNECTIVITY
1719
1825
  ###############################################################################
@@ -1804,10 +1910,12 @@ async def test_connectivity(tool_config: List[Dict[str, Any]]) -> Dict[str, Dict
1804
1910
  "aircall": test_aircall, # handled specially to pass appId + apiToken
1805
1911
  "ringover": test_ringover,
1806
1912
  "dialpad": test_dialpad, # handled specially to pass client credentials
1913
+ "twilio": test_twilio, # handled specially to pass account_sid + auth_token
1807
1914
  "nooks": test_nooks,
1808
1915
  "commonRoom": test_commonroom,
1809
1916
  "scarf": test_scarf,
1810
1917
  "theorg": test_theorg,
1918
+ "coresignal": test_coresignal,
1811
1919
  "salesforce": test_salesforce,
1812
1920
  "clay": test_clay,
1813
1921
  "posthog": test_posthog,
@@ -2020,6 +2128,23 @@ async def test_connectivity(tool_config: List[Dict[str, Any]]) -> Dict[str, Dict
2020
2128
  results[tool_name] = await test_dialpad(client_id, client_secret)
2021
2129
  continue
2022
2130
 
2131
+ # ------------------------------------------------------------------ #
2132
+ # Special-case: Twilio (account_sid + auth_token)
2133
+ # ------------------------------------------------------------------ #
2134
+ if tool_name == "twilio":
2135
+ account_sid = next((c["value"] for c in config_entries if c["name"] in ("accountSid", "account_sid")), None)
2136
+ auth_token = next((c["value"] for c in config_entries if c["name"] in ("authToken", "auth_token")), None)
2137
+ if not account_sid or not auth_token:
2138
+ results[tool_name] = {
2139
+ "success": False,
2140
+ "status_code": 0,
2141
+ "error_message": "Missing accountSid or authToken for Twilio.",
2142
+ }
2143
+ else:
2144
+ logger.info("Testing connectivity for Twilio…")
2145
+ results[tool_name] = await test_twilio(account_sid, auth_token)
2146
+ continue
2147
+
2023
2148
  # ------------------------------------------------------------------ #
2024
2149
  # All other tools – expect an apiKey by default
2025
2150
  # ------------------------------------------------------------------ #
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dhisana
3
- Version: 0.0.1.dev253
3
+ Version: 0.0.1.dev255
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
@@ -81,7 +81,7 @@ dhisana/utils/serperdev_google_jobs.py,sha256=m5_2f_5y79FOFZz1A_go6m0hIUfbbAoZ0Y
81
81
  dhisana/utils/serperdev_local_business.py,sha256=JoZfTg58Hojv61cyuwA2lcnPdLT1lawnWaBNrUYWnuQ,6447
82
82
  dhisana/utils/serperdev_search.py,sha256=_iBKIfHMq4gFv5StYz58eArriygoi1zW6VnLlux8vto,9363
83
83
  dhisana/utils/smtp_email_tools.py,sha256=J9uDHCEu2BTyFzDBru0e1lC8bsAMt9c_mYXTzJgk9Kc,22054
84
- dhisana/utils/test_connect.py,sha256=pYR1Ki6WKx-vAhLJxQ6At627xfOnlQeVRjnW7FBdGKM,86702
84
+ dhisana/utils/test_connect.py,sha256=YCweFyTRWSP3iwR3uLE0VWLIOK1qHY2OI4oNe6pCV_Y,92403
85
85
  dhisana/utils/trasform_json.py,sha256=7V72XNDpuxUX0GHN5D83z4anj_gIf5zabaHeQm7b1_E,6979
86
86
  dhisana/utils/web_download_parse_tools.py,sha256=ouXwH7CmjcRjoBfP5BWat86MvcGO-8rLCmWQe_eZKjc,7810
87
87
  dhisana/utils/workflow_code_model.py,sha256=YPWse5vBb3O6Km2PvKh1Q3AB8qBkzLt1CrR5xOL9Mro,99
@@ -95,8 +95,8 @@ dhisana/workflow/agent.py,sha256=esv7_i_XuMkV2j1nz_UlsHov_m6X5WZZiZm_tG4OBHU,565
95
95
  dhisana/workflow/flow.py,sha256=xWE3qQbM7j2B3FH8XnY3zOL_QXX4LbTW4ArndnEYJE0,1638
96
96
  dhisana/workflow/task.py,sha256=HlWz9mtrwLYByoSnePOemBUBrMEcj7KbgNjEE1oF5wo,1830
97
97
  dhisana/workflow/test.py,sha256=E7lRnXK0PguTNzyasHytLzTJdkqIPxG5_4qk4hMEeKc,3399
98
- dhisana-0.0.1.dev253.dist-info/METADATA,sha256=zs8sGuJ9Lv2en8iIMns92NleCIMmMQ4ub0bqzzimMsY,1190
99
- dhisana-0.0.1.dev253.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
100
- dhisana-0.0.1.dev253.dist-info/entry_points.txt,sha256=jujxteZmNI9EkEaK-pOCoWuBujU8TCevdkfl9ZcKHek,49
101
- dhisana-0.0.1.dev253.dist-info/top_level.txt,sha256=NETTHt6YifG_P7XtRHbQiXZlgSFk9Qh9aR-ng1XTf4s,8
102
- dhisana-0.0.1.dev253.dist-info/RECORD,,
98
+ dhisana-0.0.1.dev255.dist-info/METADATA,sha256=lwJJzuSsIrzXyK7pli9XTZzeEy8aTJAkYLKAeWDgT9c,1190
99
+ dhisana-0.0.1.dev255.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
100
+ dhisana-0.0.1.dev255.dist-info/entry_points.txt,sha256=jujxteZmNI9EkEaK-pOCoWuBujU8TCevdkfl9ZcKHek,49
101
+ dhisana-0.0.1.dev255.dist-info/top_level.txt,sha256=NETTHt6YifG_P7XtRHbQiXZlgSFk9Qh9aR-ng1XTf4s,8
102
+ dhisana-0.0.1.dev255.dist-info/RECORD,,