hired.search#
Job search functionality for the hired package.
This module provides a unified interface for searching jobs across multiple sources (Indeed, LinkedIn, USAJobs, Adzuna, etc.).
Example usage:
>>> from hired.search import JobSources, SearchCriteria
>>>
>>> # Create job sources facade
>>> sources = JobSources()
>>>
>>> # List available sources
>>> print(sources.list_available())
>>>
>>> # Search using a specific source
>>> criteria = SearchCriteria(
... query="python developer",
... location="San Francisco, CA",
... results_wanted=20
... )
>>> results = sources.jobspy.search(criteria)
>>>
>>> # Or search across all sources
>>> all_results = sources.search_all(criteria)
Functions
Get the global source registry. |
|
|
Register a source with the global registry. |
Classes
|
Main facade for accessing job search sources. |
|
Standardized search criteria across all sources. |
|
Standardized job result across all sources. |
Abstract base class for job search sources. |
|
|
Standardized job types across all sources. |
|
Location information for a job. |
|
Compensation information for a job. |
Registry for job search sources. |
|
|
JobSpy source implementation. |
|
USAJobs API source implementation. |
|
Adzuna API source implementation. |
Exceptions
Raised when a source is not properly configured. |
- class hired.search.AdzunaSource(app_id=None, app_key=None, country='us')[source]#
Bases:
JobSearchSourceAdzuna API source implementation.
Searches international job postings via the Adzuna Jobs API. Requires a free API key from https://developer.adzuna.com/.
- get_setup_instructions()[source]#
Return setup instructions for this source.
Should include:
Where to get API keys if needed
Environment variables or config file settings
URLs for documentation
- Return type:
- Returns:
Multi-line string with setup instructions.
- is_configured()[source]#
Check if this source is properly configured.
- Return type:
- Returns:
True if the source is ready to use, False otherwise.
- search(criteria)[source]#
Search for jobs using Adzuna API.
- Parameters:
criteria (
SearchCriteria) – Search criteria- Return type:
- Returns:
List of JobResult objects
- class hired.search.CompensationInfo(min_amount=None, max_amount=None, currency=None, interval=None)[source]#
Bases:
objectCompensation information for a job.
- class hired.search.JobResult(title, source, company=None, company_url=None, job_url=None, location=None, is_remote=None, description=None, job_type=None, compensation=None, date_posted=None, date_updated=None, application_deadline=None, skills=<factory>, benefits=<factory>, emails=<factory>, raw_data=<factory>)[source]#
Bases:
objectStandardized job result across all sources.
This provides a unified interface regardless of which source the job was retrieved from.
- class hired.search.JobSearchSource[source]#
Bases:
ABCAbstract base class for job search sources.
All job search sources must implement this interface to be registered in the system.
- abstract property display_name: str#
Return the display name of this source (e.g., ‘Indeed’, ‘USAJobs’).
- abstractmethod get_setup_instructions()[source]#
Return setup instructions for this source.
Should include:
Where to get API keys if needed
Environment variables or config file settings
URLs for documentation
- Return type:
- Returns:
Multi-line string with setup instructions.
- abstractmethod is_configured()[source]#
Check if this source is properly configured.
- Return type:
- Returns:
True if the source is ready to use, False otherwise.
- abstractmethod search(criteria)[source]#
Search for jobs using the given criteria.
- Parameters:
criteria (
SearchCriteria) – SearchCriteria object with search parameters- Return type:
- Returns:
List of JobResult objects
- Raises:
SourceConfigError – If the source is not properly configured
Exception – For other errors during search
- validate_configured()[source]#
Validate that the source is configured, raise error if not.
- Raises:
SourceConfigError – If the source is not properly configured
- Return type:
- class hired.search.JobSources(registry=None)[source]#
Bases:
objectMain facade for accessing job search sources.
Provides both mapping interface (dict-like access) and attribute access to registered job sources.
Examples
>>> sources = JobSources() >>> # List all available sources >>> sources.list() ['jobspy', 'usajobs', 'adzuna']
>>> # Access via attribute >>> results = sources.jobspy.search(SearchCriteria(query="python developer"))
>>> # Access via mapping >>> results = sources['indeed'].search(SearchCriteria(query="data scientist"))
>>> # Search across multiple sources >>> results = sources.search_all( ... SearchCriteria(query="software engineer", location="San Francisco") ... )
- get_source(name)[source]#
Get a source by name.
- search(source_name, criteria)[source]#
Search using a specific source.
- Parameters:
source_name (
str) – Name of the source to usecriteria (
SearchCriteria) – Search criteria
- Return type:
- Returns:
List of JobResult objects
- search_all(criteria, sources=None, skip_unconfigured=True)[source]#
Search across multiple sources.
- Parameters:
criteria (
SearchCriteria) – Search criteriasources (
Optional[List[str]]) – Optional list of source names. If None, uses all available sources.skip_unconfigured (
bool) – If True, skip sources that are not configured
- Return type:
- Returns:
Combined list of JobResult objects from all sources
- class hired.search.JobSpySource(sites=None, proxies=None)[source]#
Bases:
JobSearchSourceJobSpy source implementation.
Uses python-jobspy to scrape jobs from multiple sources simultaneously. Does not require API keys, but may be subject to rate limiting.
- get_setup_instructions()[source]#
Return setup instructions for this source.
Should include:
Where to get API keys if needed
Environment variables or config file settings
URLs for documentation
- Return type:
- Returns:
Multi-line string with setup instructions.
- is_configured()[source]#
Check if this source is properly configured.
- Return type:
- Returns:
True if the source is ready to use, False otherwise.
- search(criteria)[source]#
Search for jobs using JobSpy.
- Parameters:
criteria (
SearchCriteria) – Search criteria- Return type:
- Returns:
List of JobResult objects
- class hired.search.LocationInfo(city=None, state=None, country=None, postal_code=None, raw=None)[source]#
Bases:
objectLocation information for a job.
- class hired.search.SearchCriteria(query, location=None, country=None, city=None, state=None, postal_code=None, distance_miles=None, job_type=None, is_remote=None, posted_within_days=None, results_wanted=20, offset=0, min_salary=None, max_salary=None, keywords=<factory>, exclude_keywords=<factory>, source_params=<factory>)[source]#
Bases:
objectStandardized search criteria across all sources.
Different sources may not support all criteria, but this provides a consistent interface for users.
- exception hired.search.SourceConfigError[source]#
Bases:
ExceptionRaised when a source is not properly configured.
- class hired.search.SourceRegistry[source]#
Bases:
objectRegistry for job search sources.
Provides a plugin system where sources can be registered and retrieved by name.
- get(name)[source]#
Get a source by name.
- register(source, source_class=None)[source]#
Register a job search source.
- Parameters:
source (
JobSearchSource) – Instance of a JobSearchSource implementationsource_class (
Optional[Type[JobSearchSource]]) – Optional class of the source for reference
- Return type:
- class hired.search.USAJobsSource(api_key=None, email=None)[source]#
Bases:
JobSearchSourceUSAJobs API source implementation.
Searches US Government job postings via the official USAJobs API. Requires a free API key from https://developer.usajobs.gov/.
- get_setup_instructions()[source]#
Return setup instructions for this source.
Should include:
Where to get API keys if needed
Environment variables or config file settings
URLs for documentation
- Return type:
- Returns:
Multi-line string with setup instructions.
- is_configured()[source]#
Check if this source is properly configured.
- Return type:
- Returns:
True if the source is ready to use, False otherwise.
- search(criteria)[source]#
Search for jobs using USAJobs API.
- Parameters:
criteria (
SearchCriteria) – Search criteria- Return type:
- Returns:
List of JobResult objects
- hired.search.register_source(source, source_class=None)[source]#
Register a source with the global registry.
- Parameters:
source (
JobSearchSource) – Instance of a JobSearchSource implementationsource_class (
Optional[Type[JobSearchSource]]) – Optional class of the source for reference
- Return type:
Modules