def company_search(company): ''' Searches a company for data on hunter :return: hunter response data ''' url = '{}domain-search?company={}&api_key={}'.format( BASE_URL, company, HUNTER_API_KEY) return get_json(url)
def domain_search(domain): ''' does a hunter API domain search :param domain: domain to search :return: hunter response data ''' url = '{}domain-search?domain={}&api_key={}'.format( BASE_URL, domain, HUNTER_API_KEY) return get_json(url)
def get_domain(domain): ''' gets a domains information from the kindling DB :param domain: the domain to get information on :return domain: the domain object stored in the DB on success ''' url = KINDLING_URL + 'domain/' + domain['domain'] + '/' + KINDLING_API_KEY res = get_json(url) print(res) return res
def get_user(user): ''' gets a users information from the kindlong DB :param user: the user to get information for - only email is required :return user: returns the user object from DB on success ''' url = KINDLING_URL + 'user/' + user['email'] + '/' + KINDLING_API_KEY res = get_json(url) print(res) return res
def get_lead(lead): ''' Gets a lead from the kindling DB :param lead: the lead to get from the DB - email is all that is required :return lead: returns the lead object from the DB ''' url = KINDLING_URL + 'lead/' + lead['email'] + '/' + KINDLING_API_KEY res = get_json(url) print(res) return res
def get_format(email_format): ''' gets a format from the kidnling DB :param email_format: the format to get as a dictionary - domain is only required field :return format: if successful the format object from the DB is returned ''' url = KINDLING_URL + 'format/' + email_format[ 'domain'] + '/' + KINDLING_API_KEY res = get_json(url) print(res) return res
def get_contact_by_email(email): ''' gets a contacts info from hubspot using their email :param email: email to search for :return contact_info: ''' url = '{}contacts/v1/contact/email/{}/profile?hapikey={}'.format( BASE_URL, email, HUBSPOT_API_KEY) print(url) r = get_json(url) return r
def find_person_at_company(first_name, last_name, company): ''' finds a persons email by company :param first_name: first name of contact to find :param last_name: last name of contact to find :param company: company the contact works at :return: email of the person ''' url = '{}email-finder?company={}&first_name={}&last_name={}&api_key={}'.format( BASE_URL, company, first_name, last_name, HUNTER_API_KEY) r = get_json(url) if 'error' in r: return r return r['data']['email']
def find_person_at_domain(first_name, last_name, domain): ''' finds a persons email data by domain :param first_name: first name of contact to find :param last_name: last name of contact to find :param domain: domain of the company the contact works at :return: email data of the person ''' url = '{}email-finder?domain={}&first_name={}&last_name={}&api_key={}'.format( BASE_URL, domain, first_name, last_name, HUNTER_API_KEY) r = get_json(url) if 'error' in r: return None if r['data']['email'] is not None: return r['data'] return None
def get_format_from_domain_search(response): ''' gets a company by id from hubspot :param response: company to get :return: None or format if found ''' exists = company_exists(response) if exists: company_id = response['results'][0]['companyId'] url = '{}companies/v2/companies/{}?hapikey={}'.format( BASE_URL, company_id, HUBSPOT_API_KEY) r = get_json(url) email_format = company_has_format(r) if email_format is None: return None return email_format return None