application de scrapping pour trouver les offres d emploi au senegal publiés sur LinkedIn
# Senegal Jobs API
A FastAPI-based web service that fetches recent job postings in Senegal from LinkedIn (with mock data fallback).
## Features
- **FastAPI** framework with automatic OpenAPI documentation
- **Web scraping** of LinkedIn job listings (Senegal location)
- **Mock data** fallback when scraping is blocked or fails
- **Docker container** ready for deployment
- **RESTful endpoints** for retrieving job information
## Project Structure
```
fastapi-jobs/
├── app.py # FastAPI application with routes
├── requirements.txt # Python dependencies
├── Dockerfile # Docker configuration
├── .dockerignore # Files to exclude from Docker build
├── .gitignore # Git ignore rules
└── README.md # This file
```
## API Endpoints
### `GET /`
Welcome message.
**Response:**
```json
{"message": "Welcome to Senegal Jobs API. Use /jobs to get recent job postings in Senegal."}
```
### `GET /jobs`
Fetch recent job postings in Senegal.
**Query Parameters:**
- `days` (optional): Number of past days to look for jobs (default: 7)
- `use_mock` (optional): If `true`, returns mock data only (default: `false`)
**Response:**
```json
[
{
"title": "Software Engineer",
"company": "Tech Solutions Senegal",
"location": "Dakar, Senegal",
"posted_date": "2025-03-18",
"link": "
linkedin.com",
"description": "Develop and maintain software applications."
},
...
]
```
### `GET /jobs/{job_id}`
Get a specific job by its index in the mock data list (0‑based).
## Setup and Installation
### Using Docker (Recommended)
1. **Build the Docker image:**
```bash
docker build -t senegal-jobs-api .
```
2. **Run the container:**
```bash
docker run -p 8000:8000 senegal-jobs-api
```
3. **Access the API:**
- OpenAPI docs:
localhost
- ReDoc:
localhost
- API root:
localhost
### Local Development
1. **Create a virtual environment:**
```bash
python -m venv venv
source venv/bin/activate # On W …