Skip to content

batman1140/assignment1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Campaign Targeting Engine

A microservice that routes the right campaigns to the right requests based on targeting criteria.

Overview

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

Features

  • 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

Setup

  1. Create a virtual environment and activate it:
python -m venv venv
.\venv\Scripts\activate  # Windows
source venv/bin/activate  # Unix/MacOS
  1. Install dependencies:
pip install -r requirements.txt
  1. Set up environment variables (copy .env.example to .env and edit as needed):
FLASK_ENV=development
DATABASE_URL=sqlite:///app.db
FLASK_APP=app.py
  1. Initialize the database:
flask db upgrade
  1. Run the development server:
flask run

API Documentation

Get Matching Campaign

GET /api/v1/delivery?app_id=com.example.app&country=US&os=android

Query Parameters:

  • app_id (required): The ID of the requesting app
  • country (required): The country code of the user
  • os (required): The operating system of the user

Success Response:

{
    "success": true,
    "data": {
        "cid": "campaign_id",
        "img": "https://example.com/image.jpg",
        "cta": "Install Now"
    }
}

Testing

Run the test suite:

python -m pytest

License

MIT

About

assignment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages