PCEA cheat sheet for Python automation, files, APIs, retries, idempotency, logging, and exam traps.
Use this cheat sheet for PCEA-30-0x Certified Entry-Level Automation Specialist with Python after you can read small scripts. The exam lane is practical automation: inputs, files, APIs, retries, logs, checkpoints, outputs, and safe re-runs.
flowchart TD
S["Scenario"] --> I["What input or trigger starts the task?"]
I --> V["Validate data and configuration"]
V --> W["Do the smallest safe work step"]
W --> O["Write output, log result, and make rerun safe"]
Automation answers are weaker when they assume perfect inputs, retry forever, overwrite useful data, or leave no evidence of what happened.
| Lane | Decision rule | Reject when |
|---|---|---|
| Script structure | Use functions, clear inputs, explicit outputs, and useful exceptions. | One long script hides which step failed. |
| Files | Read, validate, transform, and write safely with backup or temp-output patterns. | The script overwrites good data before validation succeeds. |
| APIs | Handle status codes, timeouts, pagination, retries, and rate limits. | One request is assumed complete and successful. |
| Idempotency | Make re-running safe through keys, checkpoints, and conditional writes. | A retry creates duplicate records or repeated side effects. |
| Logging | Record enough evidence to diagnose success, skip, retry, or failure. | Logs are vague, missing, or full of sensitive data. |
| Configuration | Keep environment-specific settings outside source logic. | Production behavior changes require editing code. |
| Stem clue | Eliminate first | Keep in play |
|---|---|---|
| scheduled job may rerun | append duplicates every time | idempotency key, checkpoint, or safe replace |
| API returns many records | read only first response | pagination and loop until completion |
| API sometimes fails | retry forever immediately | bounded retry with timeout and backoff |
| file output is business-critical | overwrite in place | write temp output, validate, then replace |
| malformed row appears | crash with no context or silently skip everything | validate, count, quarantine, and report |
| secrets are required | hard-code in script | config or environment secret with restricted access |
| no one can diagnose failures | print only “failed” | structured logs with step, input ID, error, and action |
| Pattern | Safer instinct |
|---|---|
while True retry |
Add maximum attempts, timeout, backoff, and failure reporting. |
requests.get(url) |
Include timeout and check status/response shape. |
open(output, "w") |
Avoid destructive overwrite until validation succeeds. |
| API list endpoint | Check for pagination or continuation tokens. |
| Cron/scheduled task | Make it idempotent and log each run summary. |
| Config in source | Move environment-specific values to config/environment. |
| If the stem says… | Start with |
|---|---|
| “repeatable” | idempotency, checkpoints, deterministic inputs, and safe output |
| “API” | auth, timeout, status code, pagination, retry, and parsing |
| “file” | encoding, path, validation, overwrite behavior, and backup |
| “failed overnight” | logs, last successful step, input batch, exception, retry count |
| “least manual effort” | schedule, validate, log, notify, and avoid hidden manual cleanup |
PCEA practice should be scenario-based. For every answer, ask whether the automation can run safely tomorrow with imperfect input and still leave enough evidence to troubleshoot.