← Back to all products
$19
API Poller
Scheduled API polling tool that checks endpoints, detects changes, and sends notifications.
JSONMarkdownPython
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 9 files
api-poller/
├── LICENSE
├── README.md
├── examples/
│ └── poller_config.json
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_quick-start.md
│ └── 03_faq.md
├── index.html
└── src/
└── api_poller.py
📖 Documentation Preview README excerpt
API Poller
A scheduled API polling tool that checks HTTP endpoints at configurable intervals, detects changes in responses, sends alerts when differences are found, and archives response data to SQLite for historical comparison.
Features
- Scheduled polling — Check endpoints at configurable intervals (seconds to hours)
- Change detection — Content hashing detects when API responses change
- Alert webhooks — Send notifications when changes or errors are detected
- Response archiving — Store every response in SQLite for historical analysis
- Multi-endpoint support — Poll many endpoints with independent schedules
- One-shot mode — Poll once and exit (great for cron integration)
- History queries — Query past responses and alerts from the CLI
- Daemon mode — Run continuously with graceful shutdown
Requirements
- Python 3.10+
- No external dependencies (stdlib only)
Quick Start
# Poll an endpoint every 60 seconds
python src/api_poller.py --url https://api.example.com/v1/status --interval 60
# Poll once and print results
python src/api_poller.py --url https://api.example.com/v1/health --once
# Poll with change alerts
python src/api_poller.py --url https://api.example.com/v1/data \
--alert-webhook https://hooks.example.com/alert --interval 300
# Full config for multiple endpoints
python src/api_poller.py --config examples/poller_config.json
# View poll history
python src/api_poller.py --history
# View recent alerts
python src/api_poller.py --alerts
Configuration Reference
{
"endpoints": [
{
"name": "status-page",
"url": "https://api.example.com/v1/status",
"interval_seconds": 60,
"alert_webhook": "https://hooks.example.com/alert",
"headers": {"Authorization": "Bearer YOUR_API_TOKEN_HERE"},
"expected_status": 200
},
{
"name": "pricing-api",
"url": "https://api.example.com/v1/pricing",
"interval_seconds": 3600,
*... continues with setup instructions, usage examples, and more.*
📄 Code Sample .py preview
src/api_poller.py
#!/usr/bin/env python3
"""
API Poller — Automation Hub (DataNest)
A scheduled API polling tool that checks HTTP endpoints at configurable
intervals, detects changes in responses, sends alerts when differences
are found, and archives response data for historical comparison.
Usage:
python api_poller.py --url https://api.example.com/v1/status --interval 60
python api_poller.py --config poller_config.json
python api_poller.py --url https://api.example.com/v1/data --alert-webhook https://hooks.example.com/alert
Dependencies: Python 3.10+ stdlib only (no pip packages)
License: MIT
"""
from __future__ import annotations
import argparse
import hashlib
import json
import logging
import os
import signal
import sqlite3
import threading
import time
import urllib.error
import urllib.request
from dataclasses import dataclass, field
from datetime import datetime, timezone
from enum import Enum
from pathlib import Path
from typing import Any
# ---------------------------------------------------------------------------
# Constants
# ---------------------------------------------------------------------------
LOG_FORMAT = "%(asctime)s [%(levelname)s] %(name)s: %(message)s"
DEFAULT_INTERVAL_S = 60
DEFAULT_TIMEOUT = 30
MAX_RETRIES = 3
ARCHIVE_DB = "api_polls.db"
logger = logging.getLogger("api_poller")
# ---------------------------------------------------------------------------
# ... 627 more lines ...