← Back to all products
$29
Python Automation Scripts
50+ automation scripts for file processing, email, PDF generation, spreadsheets, APIs, and system administration.
PythonYAMLMarkdownJSONDocker
📁 File Structure 19 files
python-automation-scripts/
├── LICENSE
├── README.md
├── configs/
│ └── scripts_config.yaml
├── guides/
│ └── automation-guide.md
├── scripts/
│ ├── api_tester.py
│ ├── csv_processor.py
│ ├── db_backup.py
│ ├── docker_cleanup.py
│ ├── env_checker.py
│ ├── file_organizer.py
│ ├── git_stats.py
│ ├── log_analyzer.py
│ ├── report_generator.py
│ └── ssl_checker.py
├── tests/
│ ├── test_csv_processor.py
│ └── test_file_organizer.py
└── utils/
├── notifier.py
└── runner.py
📖 Documentation Preview README excerpt
Python Automation Scripts
10 production-ready automation scripts for file management, data processing, API testing, log analysis, backups, and more.
---
What You Get
- 10 standalone scripts — each solves a real DevOps / data task
- Shared utilities for running scripts and sending notifications
- YAML config for centralised settings
- Tests for the most complex scripts
- Guide with customisation tips and scheduling advice
File Tree
python-automation-scripts/
├── README.md
├── manifest.json
├── LICENSE
├── scripts/
│ ├── file_organizer.py # Sort files into folders by type/date
│ ├── csv_processor.py # Clean, filter, and transform CSVs
│ ├── api_tester.py # Smoke-test REST APIs
│ ├── log_analyzer.py # Parse logs, extract errors, summarise
│ ├── db_backup.py # Backup SQLite/Postgres to compressed archive
│ ├── env_checker.py # Verify Python env & dependencies
│ ├── report_generator.py # Generate HTML/PDF reports from data
│ ├── git_stats.py # Analyse git repo commit history
│ ├── docker_cleanup.py # Prune unused Docker resources
│ └── ssl_checker.py # Check SSL certificate expiry dates
├── utils/
│ ├── runner.py # Script runner with logging & timing
│ └── notifier.py # Send alerts via email / Slack / webhook
├── configs/
│ └── scripts_config.yaml # Centralised configuration
├── tests/
│ ├── test_csv_processor.py # Tests for CSV processing
│ └── test_file_organizer.py # Tests for file organiser
└── guides/
└── automation-guide.md # Customisation & scheduling guide
Getting Started
1. Install Dependencies
pip install pyyaml requests jinja2
2. Run a Script
python scripts/file_organizer.py --source ~/Downloads --dest ~/Sorted
3. Use the Runner
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
scripts/api_tester.py
"""API Tester — smoke-test REST API endpoints from a YAML spec.
Usage:
python api_tester.py --config api_tests.yaml
python api_tester.py --url https://api.example.com/health --method GET --expect 200
"""
from __future__ import annotations
import argparse
import json
import sys
import time
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any
import requests
import yaml
@dataclass
class TestCase:
"""A single API test definition."""
name: str
url: str
method: str = "GET"
headers: dict[str, str] = field(default_factory=dict)
body: dict[str, Any] | None = None
expected_status: int = 200
expected_json: dict[str, Any] | None = None
timeout: float = 10.0
@dataclass
class TestResult:
"""Result of running a single test case."""
name: str
passed: bool
status_code: int
elapsed_ms: float
error: str | None = None
def run_test(tc: TestCase) -> TestResult:
"""Execute a single API test and return the result."""
try:
start = time.monotonic()
# ... 76 more lines ...