A microservice that routes the right campaigns to the right requests based on targeting criteria.
This service provides campaign targeting capabilities through a simple HTTP API. It matches incoming requests with campaigns based on various targeting criteria such as:
- App ID
- Country
- Operating System
--vignesh prabhummit -m"edited readme file
- Campaign management with active/inactive states
- Flexible targeting rules with include/exclude conditions
- SQLite database for easy development (configurable for production)
- RESTful API for campaign delivery
- Comprehensive test coverage
- Create a virtual environment and activate it:
python -m venv venv
.\venv\Scripts\activate # Windows
source venv/bin/activate # Unix/MacOS- Install dependencies:
pip install -r requirements.txt- Set up environment variables (copy
.env.exampleto.envand edit as needed):
FLASK_ENV=development
DATABASE_URL=sqlite:///app.db
FLASK_APP=app.py
- Initialize the database:
flask db upgrade- Run the development server:
flask runGET /api/v1/delivery?app_id=com.example.app&country=US&os=androidQuery Parameters:
app_id(required): The ID of the requesting appcountry(required): The country code of the useros(required): The operating system of the user
Success Response:
{
"success": true,
"data": {
"cid": "campaign_id",
"img": "https://example.com/image.jpg",
"cta": "Install Now"
}
}Run the test suite:
python -m pytestMIT