PyHunter
A Python wrapper for the Hunter.io v2 API
Installation
Requirements:
- Python 3 (no Python 2 version)
To install:
pip install pyhunter
For async support:
pip install "pyhunter[test]"
Usage
Import the PyHunter and instantiate it:
from pyhunter import PyHunter
hunter = PyHunter('my_hunter_api_key')
You can configure transport behavior:
hunter = PyHunter(
'my_hunter_api_key',
timeout=10,
max_retries=2,
retry_backoff=0.5,
)
Async Usage
from pyhunter import AsyncPyHunter
async with AsyncPyHunter('my_hunter_api_key') as hunter:
result = await hunter.domain_search('instagram.com')
For long-lived clients:
hunter = AsyncPyHunter('my_hunter_api_key')
try:
data = await hunter.email_count('instagram.com')
finally:
await hunter.aclose()
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.
Transport and HTTP failures raise typed exceptions:
HunterTransportErrorfor connectivity/timeoutsHunterApiErrorfor non-2xx and malformed API payloads
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)
Logos
Get a company logo by domain (returns bytes):
logo_bytes = hunter.logo('stripe.com')
Async:
from pyhunter import AsyncPyHunter
async with AsyncPyHunter('my_hunter_api_key') as async_hunter:
logo_bytes = await async_hunter.logo('stripe.com')
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!
Metadata
Release files for pyhunter 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyhunter-2.1.0.tar.gz | 16.6 kB | Without provenance | Details for pyhunter-2.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyhunter-2.1.0-py3-none-any.whl | Python 3 | none | any | Details for pyhunter-2.1.0-py3-none-any.whl |
Total release size: 30.9 kB
Release files / pyhunter-2.1.0.tar.gz
| Download URL | pyhunter-2.1.0.tar.gz |
|---|---|
| Size | 16.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
633ba78a05de48cc84b59e0bad8635bc1d000b7c10f63a92ebf27da0dbdf3593
|
|
BLAKE2b-256 checksum How to use checksums |
e57215b632ca9b52ba08dbe2709a663ff6d9dd86564909d85e5f53f279b20164
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Release files / pyhunter-2.1.0-py3-none-any.whl
| Download URL | pyhunter-2.1.0-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2831ecd01704e859449894da663d0cdbeb36db015416bfdfb17f0e23e9cec608
|
|
BLAKE2b-256 checksum How to use checksums |
5391b7ab6b49f81738311f9b9de6329031bbccfc3609f5f73163a38f14ab810a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.2
|
Security for pyhunter 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.