A Python wrapper for the Hunter.io v2 API
Requirements:
To install:
pip install pyhunter
Import the PyHunter and instantiate it:
from pyhunter import PyHunter
hunter = PyHunter('my_hunter_api_key')
Search all email addresses for a given domain:
hunter.domain_search('instagram.com')
Pass the company name instead, along with optional filters:
hunter.domain_search(
company='Instagram',
limit=5,
offset=2,
emails_type='personal',
seniority='senior,executive',
department='sales,marketing',
required_field='full_name',
verification_status='valid',
)
Find a specific person’s email address:
email, confidence_score = hunter.email_finder('instagram.com', first_name='Kevin', last_name='Systrom')
Use the company name, full name, or LinkedIn handle instead:
hunter.email_finder(company='Instagram', full_name='Kevin Systrom', raw=True)
hunter.email_finder(linkedin_handle='kevinsystrom', max_duration=15)
Check the deliverability of an email address:
hunter.email_verifier('kevin@instagram.com')
Check how many email addresses Hunter has for a given domain:
hunter.email_count('instagram.com')
# or by company name
hunter.email_count(company='Instagram')
Check your account information and remaining API calls:
hunter.account_information()
PyHunter adds a calls['left'] field to the response with the number of API calls still available.
NOTE: By default, all calls return the data element of the JSON response. Pass raw=True to get the full HTTP response object, including headers (e.g. X-RateLimit-Remaining) and the complete response body including meta.
Look up all information about a person from their email or LinkedIn handle:
hunter.email_enrichment(email='kevin@instagram.com')
hunter.email_enrichment(linkedin_handle='kevinsystrom')
Look up all information about a company from its domain:
hunter.company_enrichment('instagram.com')
Get combined person + company information in one call:
hunter.combined_enrichment('kevin@instagram.com')
All enrichment methods accept a clearbit_format=True parameter to return data in Clearbit-compatible format.
Find companies matching a set of criteria:
hunter.discover(query='Tech companies in Europe')
hunter.discover(
industry={'include': ['Technology', 'Software']},
headcount=['51-200', '201-500'],
headquarters_location={'include': [{'country': 'France'}]},
limit=50,
)
Get all leads:
hunter.get_leads()
Filter leads:
hunter.get_leads(
offset=2,
limit=10,
lead_list_id=1,
first_name='Kevin',
last_name='Systrom',
email='kevin@instagram.com',
company='Instagram',
phone_number='0102030405',
twitter='kevin',
position='CEO',
sync_status='success',
query='kevin',
)
Get a specific lead by id:
hunter.get_lead(42)
Create a lead:
hunter.create_lead(
'Quentin', 'Durantay',
email='quentin.durantay@unicorn.io',
position='CEO',
company='Unicorn Consulting',
company_size=10,
confidence_score=100,
website='unicornsaregreat.io',
country_code='FR',
postal_code=75000,
source='theinternet.com',
linkedin_url='www.linkedin.com/in/masteroftheuniverse',
phone_number='0102030405',
twitter='quentindty',
notes='Met at a conference',
leads_list_id=1,
leads_list_ids=[1, 2, 3],
)
Create or update a lead by email (upsert):
hunter.upsert_lead('kevin@instagram.com', first_name='Kevin', last_name='Systrom')
Update a lead by id:
hunter.update_lead(1, position='CEO in chief', notes='Updated notes')
Delete a lead by id:
hunter.delete_lead(42)
Get all leads lists:
hunter.get_leads_lists()
hunter.get_leads_lists(offset=3, limit=2)
Get a specific leads list by id:
hunter.get_leads_list(42)
Create a leads list:
hunter.create_leads_list('Ultra hot prospects')
Update a leads list:
hunter.update_leads_list(42, 'Ultra mega hot prospects')
Delete a leads list:
hunter.delete_leads_list(42)
Manage custom attributes for your leads:
# List all custom attributes
hunter.get_leads_custom_attributes()
# Get a specific custom attribute
hunter.get_leads_custom_attribute(1)
# Create a new custom attribute
hunter.create_leads_custom_attribute('Priority Level')
# Update a custom attribute
hunter.update_leads_custom_attribute(1, 'Deal Priority')
# Delete a custom attribute
hunter.delete_leads_custom_attribute(1)
Manage your email sequences:
# List all campaigns
hunter.get_campaigns()
hunter.get_campaigns(started=True, limit=10)
# Get recipients of a campaign
hunter.get_campaign_recipients(42)
# Add recipients to a campaign
hunter.add_campaign_recipients(42, emails=['kevin@instagram.com', 'jack@twitter.com'])
hunter.add_campaign_recipients(42, lead_ids=[1, 2, 3])
# Cancel scheduled emails to recipients
hunter.cancel_campaign_recipients(42, emails=['kevin@instagram.com'])
# Start a campaign
hunter.start_campaign(42)
If you find a bug or something is missing, feel free to open an issue or a pull request on GitHub.
It’s my first (ever) open-source library! So it can be improved. Feel very welcome to fork it and ask for pull requests if you find something buggy or lacking ;)