Skip to main content

An (unofficial) Python wrapper for the Hunter.io API

Project description

PyPI version

PyHunter

A Python wrapper for the Hunter.io v2 API

Installation

Requirements:

  • Python 3 (no Python 2 version)

To install:

pip install pyhunter

Usage

Import the PyHunter and instantiate it:

from pyhunter import PyHunter
hunter = PyHunter('my_hunter_api_key')

Domain Search

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',
)

Email Finder

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)

Email Verifier

Check the deliverability of an email address:

hunter.email_verifier('kevin@instagram.com')

Email Count

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')

Account Information

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.


Enrichment

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.


Discover

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,
)

Leads

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)

Leads Lists

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)

Custom Attributes

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)

Campaigns (Email Sequences)

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)

Information

If you find a bug or something is missing, feel free to open an issue or a pull request on GitHub.

Contribute

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 ;)

Have a nice day scraping B2B emails with PyHunter!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyhunter-2.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyhunter-2.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file pyhunter-2.0.tar.gz.

File metadata

  • Download URL: pyhunter-2.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for pyhunter-2.0.tar.gz
Algorithm Hash digest
SHA256 ac7708b353eba8cb82dcc03cf5302c21a4b5c594791a461841ecf64dacffdf51
MD5 c59b257b320b06adbf0d75783c376425
BLAKE2b-256 a0e3533ddc9fc8e1cd9b39ca983258e0d04ad93b19a57fc9956a5d37fbca7e07

See more details on using hashes here.

File details

Details for the file pyhunter-2.0-py3-none-any.whl.

File metadata

  • Download URL: pyhunter-2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.2

File hashes

Hashes for pyhunter-2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7063928b45044180cae06474b020090ba516bbebbc92b7fcd169cfefdee8ac12
MD5 f5caa50b43da739454c3db6b55b9d73d
BLAKE2b-256 1e03acc54ccfea869ca7d2c83b5c7e9a3fa454f404ecc3118a19f0f59738ec04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page