FastAPI + Python scraping service for job listings, with a small CLI for scraping and printing normalized JSON.
- FastAPI app with a health endpoint at
/health - Job scrapers under
scraper/:gaijinpot.pydaijob.py
- CLI entrypoint in
cli.py(currently wired for GaijinPot command)
- Python 3.11+
- FastAPI
- SQLModel (installed, data layer scaffolding in progress)
- httpx
- BeautifulSoup4
- APScheduler
- python-dotenv
- Uvicorn
api/main.py- FastAPI app entrypointcli.py- command-line interfacescraper/- parsing + fetch logic for job sourcesmodels/- model package placeholderscheduler/- scheduler package placeholder
- Create and activate a virtual environment.
- Install the project in editable mode:
pip install -e .This installs dependencies from pyproject.toml and registers the python-scrap-fastapi CLI command.
From the repository root:
uvicorn api.main:app --reloadHealth check:
curl http://127.0.0.1:8000/healthExpected response:
{"status":"ok"}Run the built-in scraper command:
python-scrap-fastapi gaijinpotOptional arguments:
--url- override the source URL--timeout- request timeout in seconds (default:20.0)
Example:
python-scrap-fastapi gaijinpot --timeout 30Output is a JSON array of normalized listings with fields like:
titlecompanylocationurldate_posteddescription_snippet
- Environment variables are loaded from
.envat API startup viapython-dotenv. - Current CLI command coverage is GaijinPot; Daijob scraper logic exists and can be integrated into CLI/API routes next.
- Parser selectors are intentionally resilient and include fallbacks for partial/mixed markup structures.
- Add API route(s) that return scraper output directly.
- Add CLI subcommand for Daijob.
- Add tests for
parse_gaijinpot_jobsandparse_daijob_jobs. - Define and persist models using SQLModel.
- Add scheduled scraping with APScheduler.