Skip to main content

Official Python SDK for the HeroHunt People Search API — search and enrich talent profiles across LinkedIn, GitHub, and StackOverflow.

Project description

herohunt

PyPI Python License Types

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.typed marker, mypy --strict clean)
  • Automatic retries with exponential backoff and Retry-After support
  • 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

License

MIT — see LICENSE.

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

herohunt-0.1.0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

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

herohunt-0.1.0-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file herohunt-0.1.0.tar.gz.

File metadata

  • Download URL: herohunt-0.1.0.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for herohunt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 073970eccc4c7007c0b7fe1c5d034fc5e04ddd33b8e223b78f6c46d725466809
MD5 b91a4d6d4aef5794ab76bc53b09c2a4a
BLAKE2b-256 adf2ee158905971469a031822f8fce9e60bf62671c54e7bd8631f385823d1beb

See more details on using hashes here.

File details

Details for the file herohunt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: herohunt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for herohunt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 994cf7d78b17666e6490dcf4c7ee278ee9dbb401e5b6a3723dfebf2671088b2a
MD5 31c869d2eaa429dd39646c754e3279a7
BLAKE2b-256 f51a06f2a415ff626194c65bff5dc5418dbc16d0b8761eaf69d2df7005994797

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