This project provides a stateless FastAPI microservice and a web frontend to ingest audience list data into Display & Video 360 (DV360) using the Data Manager API.
- Stateless Backend: Acts as a pass-through to Google's Data Manager API.
- Dynamic Payload Construction: Supports Partner and Advertiser level destinations.
- CSV Parsing: Handles client-side CSV parsing.
- Secure Handling: No sensitive data is logged; simple pass-through.
- Python 3.9+
- pip (Python package installer)
- Clone the Repository and navigate to this directory.
- Install Dependencies:
pip install fastapi uvicorn requests pydantic
Initialize your microservice to accept ingress queries:
python3 -m uvicorn main:app --reload --port 8000(The server will run on http://localhost:8000/)
Navigating to the served root address will load the interactive elements instead of file-caching! Open your web browser directly to:
http://localhost:8000/- Acquire Access Tone:
- Go to Google OAuth 2.0 Playground.
- Enter scope:
https://www.googleapis.com/auth/datamanager. - Click "Authorize APIs" and exchange the authentication authorization code.
- Input Details on the Frontend: Complete the fields (Bearer Token, Partner ID, Advertiser ID, Audience ID (Destination), CSV upload).
- Push Data: Click "Push to DV360".
You can trace specific upload events using this automated helper script:
python3 check_status.py <requestId>(Optionally include the access token as a subsequent argument if yours expired).
- Defaults: The script comes with predefined default values for
SERVICE_NAME,PROJECT_ID,BUCKET_NAME, andREGION. - Interactive Configuration: When run, it prompts you to confirm or change these deployment configuration values. You can hit
Enterto accept the defaults for each prompt. - GCS Bucket Creation: It attempts to create the specified GCS bucket (
gsutil mb) in your chosen project and region. It will silently succeed if the bucket already exists. - Cloud Run Deployment: It then deploys the service to Google Cloud Run using the
gcloud run deploycommand.- It deploys the source code from the current directory (
.). - Uses a specified
SERVICE_ACCOUNTfor deployment. - Sets a
timeoutof 3600 seconds,memoryto 4Gi, andcputo 2. - Deploys without allowing unauthenticated access (
--no-allow-unauthenticated). - Sets environment variables
PROJECT_ID,GCS_BUCKET, andENVfor your application to use at runtime.
- It deploys the source code from the current directory (
Simply execute the script in your terminal:
bash deploy.sh