Python Automation Script
Generate Python scripts for automating repetitive tasks
codingpythonautomationscripting
Prompt Template
Write a Python script that automates: {task}
Input: {input}
Output: {output}
Frequency: {frequency}
Requirements:
- Include error handling and logging
- Add progress indicators for long operations
- Make it configurable (no hardcoded values)
- Include a dry-run mode
- Add docstrings and usage examplesVariables
{task}Example: backing up a PostgreSQL database to S3
{input}Example: Database connection string
{output}Example: Compressed backup file on S3
{frequency}Example: Daily at midnight
Example Output
```python
import subprocess
import boto3
from datetime import datetime
def backup_database(conn_str: str, bucket: str, dry_run: bool = False):
...
```Tips
- Specify the Python version
- Mention any libraries you prefer