Server Module

HTTP Server - 12-Factor App Factor VII: Port Binding.

class server.ApplicationRequest(*, title: str, company: str, location: str, url: str, source: str)[source]

Bases: BaseModel

company: str
location: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

source: str
title: str
url: str
class server.JobResponse(*, title: str, company: str, location: str, url: str, source: str, posted_date: str | None = None)[source]

Bases: BaseModel

company: str
location: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

posted_date: str | None
source: str
title: str
url: str
class server.SearchRequest(*, tags: List[str] | None = None)[source]

Bases: BaseModel

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

tags: List[str] | None
async server.add_application(app: ApplicationRequest)[source]

Record a new job application.

async server.get_application_status(url: str)[source]

Get status of a specific application.

async server.get_applications()[source]

Get all tracked applications.

async server.health()[source]

Health check endpoint.

server.lifespan(app: FastAPI)[source]

Factor IX: Disposability - clean startup/shutdown.

async server.root()[source]

Serve the Web UI - Factor VII: Port Binding.

server.run_server()[source]

Run the HTTP server.

async server.search_jobs()[source]

Search for jobs - triggers job search pipeline.

async server.update_application_status(url: str, status: str, notes: str = '')[source]

Update application status.

FastAPI Application

The server module provides a REST API for the Job Agent.

Endpoints

GET /

Health check endpoint.

Returns:

Service status

Rtype:

dict

GET /health

Detailed health check.

Returns:

Health status

Rtype:

dict

GET /jobs

Search for jobs.

Returns:

List of jobs

Rtype:

dict

GET /applications

Get or add applications.

Returns:

Application list or status

Rtype:

dict