dhisana 0.0.1.dev243__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.
- dhisana/__init__.py +1 -0
- dhisana/cli/__init__.py +1 -0
- dhisana/cli/cli.py +20 -0
- dhisana/cli/datasets.py +27 -0
- dhisana/cli/models.py +26 -0
- dhisana/cli/predictions.py +20 -0
- dhisana/schemas/__init__.py +1 -0
- dhisana/schemas/common.py +399 -0
- dhisana/schemas/sales.py +965 -0
- dhisana/ui/__init__.py +1 -0
- dhisana/ui/components.py +472 -0
- dhisana/utils/__init__.py +1 -0
- dhisana/utils/add_mapping.py +352 -0
- dhisana/utils/agent_tools.py +51 -0
- dhisana/utils/apollo_tools.py +1597 -0
- dhisana/utils/assistant_tool_tag.py +4 -0
- dhisana/utils/built_with_api_tools.py +282 -0
- dhisana/utils/cache_output_tools.py +98 -0
- dhisana/utils/cache_output_tools_local.py +78 -0
- dhisana/utils/check_email_validity_tools.py +717 -0
- dhisana/utils/check_for_intent_signal.py +107 -0
- dhisana/utils/check_linkedin_url_validity.py +209 -0
- dhisana/utils/clay_tools.py +43 -0
- dhisana/utils/clean_properties.py +135 -0
- dhisana/utils/company_utils.py +60 -0
- dhisana/utils/compose_salesnav_query.py +259 -0
- dhisana/utils/compose_search_query.py +759 -0
- dhisana/utils/compose_three_step_workflow.py +234 -0
- dhisana/utils/composite_tools.py +137 -0
- dhisana/utils/dataframe_tools.py +237 -0
- dhisana/utils/domain_parser.py +45 -0
- dhisana/utils/email_body_utils.py +72 -0
- dhisana/utils/email_parse_helpers.py +132 -0
- dhisana/utils/email_provider.py +375 -0
- dhisana/utils/enrich_lead_information.py +933 -0
- dhisana/utils/extract_email_content_for_llm.py +101 -0
- dhisana/utils/fetch_openai_config.py +129 -0
- dhisana/utils/field_validators.py +426 -0
- dhisana/utils/g2_tools.py +104 -0
- dhisana/utils/generate_content.py +41 -0
- dhisana/utils/generate_custom_message.py +271 -0
- dhisana/utils/generate_email.py +278 -0
- dhisana/utils/generate_email_response.py +465 -0
- dhisana/utils/generate_flow.py +102 -0
- dhisana/utils/generate_leads_salesnav.py +303 -0
- dhisana/utils/generate_linkedin_connect_message.py +224 -0
- dhisana/utils/generate_linkedin_response_message.py +317 -0
- dhisana/utils/generate_structured_output_internal.py +462 -0
- dhisana/utils/google_custom_search.py +267 -0
- dhisana/utils/google_oauth_tools.py +727 -0
- dhisana/utils/google_workspace_tools.py +1294 -0
- dhisana/utils/hubspot_clearbit.py +96 -0
- dhisana/utils/hubspot_crm_tools.py +2440 -0
- dhisana/utils/instantly_tools.py +149 -0
- dhisana/utils/linkedin_crawler.py +168 -0
- dhisana/utils/lusha_tools.py +333 -0
- dhisana/utils/mailgun_tools.py +156 -0
- dhisana/utils/mailreach_tools.py +123 -0
- dhisana/utils/microsoft365_tools.py +455 -0
- dhisana/utils/openai_assistant_and_file_utils.py +267 -0
- dhisana/utils/openai_helpers.py +977 -0
- dhisana/utils/openapi_spec_to_tools.py +45 -0
- dhisana/utils/openapi_tool/__init__.py +1 -0
- dhisana/utils/openapi_tool/api_models.py +633 -0
- dhisana/utils/openapi_tool/convert_openai_spec_to_tool.py +271 -0
- dhisana/utils/openapi_tool/openapi_tool.py +319 -0
- dhisana/utils/parse_linkedin_messages_txt.py +100 -0
- dhisana/utils/profile.py +37 -0
- dhisana/utils/proxy_curl_tools.py +1226 -0
- dhisana/utils/proxycurl_search_leads.py +426 -0
- dhisana/utils/python_function_to_tools.py +83 -0
- dhisana/utils/research_lead.py +176 -0
- dhisana/utils/sales_navigator_crawler.py +1103 -0
- dhisana/utils/salesforce_crm_tools.py +477 -0
- dhisana/utils/search_router.py +131 -0
- dhisana/utils/search_router_jobs.py +51 -0
- dhisana/utils/sendgrid_tools.py +162 -0
- dhisana/utils/serarch_router_local_business.py +75 -0
- dhisana/utils/serpapi_additional_tools.py +290 -0
- dhisana/utils/serpapi_google_jobs.py +117 -0
- dhisana/utils/serpapi_google_search.py +188 -0
- dhisana/utils/serpapi_local_business_search.py +129 -0
- dhisana/utils/serpapi_search_tools.py +852 -0
- dhisana/utils/serperdev_google_jobs.py +125 -0
- dhisana/utils/serperdev_local_business.py +154 -0
- dhisana/utils/serperdev_search.py +233 -0
- dhisana/utils/smtp_email_tools.py +582 -0
- dhisana/utils/test_connect.py +2087 -0
- dhisana/utils/trasform_json.py +173 -0
- dhisana/utils/web_download_parse_tools.py +189 -0
- dhisana/utils/workflow_code_model.py +5 -0
- dhisana/utils/zoominfo_tools.py +357 -0
- dhisana/workflow/__init__.py +1 -0
- dhisana/workflow/agent.py +18 -0
- dhisana/workflow/flow.py +44 -0
- dhisana/workflow/task.py +43 -0
- dhisana/workflow/test.py +90 -0
- dhisana-0.0.1.dev243.dist-info/METADATA +43 -0
- dhisana-0.0.1.dev243.dist-info/RECORD +102 -0
- dhisana-0.0.1.dev243.dist-info/WHEEL +5 -0
- dhisana-0.0.1.dev243.dist-info/entry_points.txt +2 -0
- dhisana-0.0.1.dev243.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import aiohttp
|
|
3
|
+
import backoff
|
|
4
|
+
import logging
|
|
5
|
+
from dhisana.utils.assistant_tool_tag import assistant_tool
|
|
6
|
+
from dhisana.utils.cache_output_tools import cache_output, retrieve_output
|
|
7
|
+
|
|
8
|
+
# Use hubspot to resolve company name to domain name. Clearbit is not part of Hubspot.
|
|
9
|
+
|
|
10
|
+
@assistant_tool
|
|
11
|
+
@backoff.on_exception(
|
|
12
|
+
backoff.expo,
|
|
13
|
+
aiohttp.ClientResponseError,
|
|
14
|
+
max_tries=3,
|
|
15
|
+
giveup=lambda e: e.status != 429,
|
|
16
|
+
factor=60,
|
|
17
|
+
)
|
|
18
|
+
async def get_company_domain_from_breeze(company_name: str):
|
|
19
|
+
"""
|
|
20
|
+
Fetch a company's domain from HubSpot's Breeze Intelligence using the company name.
|
|
21
|
+
|
|
22
|
+
Parameters:
|
|
23
|
+
- company_name (str): Name of the company.
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
- dict: JSON response containing the domain or an error message.
|
|
27
|
+
"""
|
|
28
|
+
HUBSPOT_API_KEY = os.environ.get('HUBSPOT_API_KEY')
|
|
29
|
+
if not HUBSPOT_API_KEY:
|
|
30
|
+
return {
|
|
31
|
+
'error': "HubSpot integration is not configured. Please configure the connection to HubSpot in Integrations."
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if not company_name:
|
|
35
|
+
return {'error': "Company name must be provided"}
|
|
36
|
+
|
|
37
|
+
headers = {
|
|
38
|
+
"Authorization": f"Bearer {HUBSPOT_API_KEY}",
|
|
39
|
+
"Content-Type": "application/json",
|
|
40
|
+
"Cache-Control": "no-cache",
|
|
41
|
+
"Accept": "application/json"
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Check if response is already cached
|
|
45
|
+
cached_response = retrieve_output("get_company_domain_from_breeze", company_name)
|
|
46
|
+
if cached_response is not None:
|
|
47
|
+
return cached_response
|
|
48
|
+
|
|
49
|
+
url = "https://api.hubapi.com/crm/v3/objects/companies/search"
|
|
50
|
+
|
|
51
|
+
# Define the request body for searching companies by name
|
|
52
|
+
body = {
|
|
53
|
+
"filterGroups": [
|
|
54
|
+
{
|
|
55
|
+
"filters": [
|
|
56
|
+
{
|
|
57
|
+
"propertyName": "name",
|
|
58
|
+
"operator": "EQ",
|
|
59
|
+
"value": company_name
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"properties": ["domain"]
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
async with aiohttp.ClientSession() as session:
|
|
68
|
+
async with session.post(url, headers=headers, json=body) as response:
|
|
69
|
+
if response.status == 200:
|
|
70
|
+
result = await response.json()
|
|
71
|
+
results = result.get('results', [])
|
|
72
|
+
if results:
|
|
73
|
+
company_data = results[0]
|
|
74
|
+
domain = company_data.get('properties', {}).get('domain')
|
|
75
|
+
if domain:
|
|
76
|
+
cache_output("get_company_domain_from_breeze", company_name, {"domain": domain})
|
|
77
|
+
return {"domain": domain}
|
|
78
|
+
else:
|
|
79
|
+
return {'error': "Domain not found for the given company name"}
|
|
80
|
+
else:
|
|
81
|
+
return {'error': "No company found with the given name"}
|
|
82
|
+
elif response.status == 429:
|
|
83
|
+
logging.warning("Rate limit hi in get_company_domain_from_breeze")
|
|
84
|
+
raise aiohttp.ClientResponseError(
|
|
85
|
+
request_info=response.request_info,
|
|
86
|
+
history=response.history,
|
|
87
|
+
status=response.status,
|
|
88
|
+
message="Rate limit exceeded",
|
|
89
|
+
headers=response.headers
|
|
90
|
+
)
|
|
91
|
+
else:
|
|
92
|
+
try:
|
|
93
|
+
error_data = await response.json()
|
|
94
|
+
return {'error': error_data}
|
|
95
|
+
except Exception as e:
|
|
96
|
+
return {'error': f"Unexpected error: {str(e)}"}
|