herohunt
Official Python SDK for the HeroHunt People Search API. Search and enrich talent profiles across LinkedIn, GitHub, and StackOverflow with one natural-language call.
- Synchronous and asynchronous clients sharing the same surface
- Fully typed (pydantic v2 models,
py.typedmarker,mypy --strictclean) - Automatic retries with exponential backoff and
Retry-Aftersupport - Per-response credit + rate-limit metadata
- 100% test coverage of public endpoints
Install
pip install herohunt
Get an API key
Sign up at herohunt.ai/api/sign-up. The free tier gives you credits to play with right away.
Export your key once:
export HEROHUNT_API_KEY=ps_live_your_key
Quick start
from herohunt import HeroHunt
client = HeroHunt() # reads HEROHUNT_API_KEY from env
result = client.people_search.search(
"Senior React engineers in Berlin with TypeScript",
max_results=50,
enrich=True,
)
print(f"Found {result.total_results} profiles")
for profile in result.results:
print(f"- {profile.first_name} {profile.last_name} — {profile.headline}")
print(f" {profile.profile_url}")
if profile.emails:
print(f" Email: {profile.emails[0].value}")
Paginate the same search for free
page_2 = client.people_search.paginate(result.search_id, page=2)
Async
import asyncio
from herohunt import AsyncHeroHunt
async def main() -> None:
async with AsyncHeroHunt() as client:
result = await client.people_search.search(
"Staff Go engineers in San Francisco",
max_results=25,
)
for profile in result.results:
print(profile.first_name, profile.headline)
asyncio.run(main())
Account & billing
usage = client.account.usage()
print(f"Plan: {usage.plan}")
print(f"Credits: {usage.credits_remaining}/{usage.credits_total}")
print(f"Rate limit: {usage.rate_limit} req/min")
history = client.account.searches(limit=10)
for past in history.items:
print(past.created_at, past.query, past.total_results)
API keys
key = client.api_keys.create("CI bot")
print(key.api_key) # full key shown ONLY ONCE — store it now
for k in client.api_keys.list():
print(k.key_prefix, k.name, k.scopes)
# Rotate or revoke
client.api_keys.rotate(key_id="...")
client.api_keys.revoke(key_id="...")
Errors
Every error inherits from HeroHuntError, so catching that is always safe. The SDK exposes typed subclasses so you can branch on the failure mode without parsing strings.
from herohunt import (
HeroHunt,
AuthenticationError,
InsufficientCreditsError,
RateLimitError,
)
client = HeroHunt()
try:
result = client.people_search.search("Backend engineers in Lisbon")
except AuthenticationError:
print("Bad or revoked API key — generate a new one at the dashboard.")
except InsufficientCreditsError as exc:
print(f"Out of credits: {exc.credits_remaining} left. Resets {exc.credit_reset_date}.")
except RateLimitError as exc:
print(f"Slow down — retry in {exc.retry_after}s.")
| Status | Exception | Why |
|---|---|---|
| 400 | BadRequestError |
Missing query / search_id, bad enums |
| 401 | AuthenticationError |
API key missing, invalid, or revoked |
| 402 | InsufficientCreditsError |
Not enough credits for the reservation |
| 403 | ForbiddenError |
Scope missing or IP not allowlisted |
| 404 | NotFoundError |
Search / key / account not found |
| 429 | RateLimitError |
Per-minute rate limit exceeded |
| 5xx | ServerError |
Upstream failure (also auto-retried) |
| — | APIConnectionError |
Local network error |
Inspecting credit usage
Every response object carries a response_meta field built from the response headers:
result = client.people_search.search("Data engineers in Toronto", max_results=30)
print(result.response_meta.credits_used) # e.g. 30
print(result.response_meta.credits_remaining) # remaining balance
print(result.response_meta.request_id) # to share with support
Configuration
from herohunt import HeroHunt
client = HeroHunt(
api_key="ps_live_...", # or HEROHUNT_API_KEY env var
base_url="https://api.herohunt.ai", # or HEROHUNT_BASE_URL env var
timeout=120.0, # seconds, applied per call
max_retries=2, # 429 / 5xx auto-retries
default_headers={"X-My-Trace": "..."}, # added to every request
)
Pass a custom httpx.Client / httpx.AsyncClient via http_client= to plug in your own transport, proxy, or instrumentation.
Resources
- API reference: herohunt.ai/people-search-api/docs
- OpenAPI spec: api.herohunt.ai/people-api-docs
- Product page: herohunt.ai/people-search-api
- MCP server companion: herohunt-mcp on npm
- Issue tracker: github.com/herohunt-ai/herohunt-python/issues
License
MIT — see LICENSE.
Metadata
Release files for herohunt 0.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 |
|---|---|---|---|---|
| herohunt-0.1.0.tar.gz | 16.5 kB | Without provenance | Details for herohunt-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| herohunt-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for herohunt-0.1.0-py3-none-any.whl |
Total release size: 37.2 kB
Release files / herohunt-0.1.0.tar.gz
| Download URL | herohunt-0.1.0.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
073970eccc4c7007c0b7fe1c5d034fc5e04ddd33b8e223b78f6c46d725466809
|
|
BLAKE2b-256 checksum How to use checksums |
adf2ee158905971469a031822f8fce9e60bf62671c54e7bd8631f385823d1beb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Release files / herohunt-0.1.0-py3-none-any.whl
| Download URL | herohunt-0.1.0-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
994cf7d78b17666e6490dcf4c7ee278ee9dbb401e5b6a3723dfebf2671088b2a
|
|
BLAKE2b-256 checksum How to use checksums |
f51a06f2a415ff626194c65bff5dc5418dbc16d0b8761eaf69d2df7005994797
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.2
|
Security for herohunt 0.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.