6. Python audit utility
About 1 min read · reviewed 2026-11-26
6. Python audit utility
The supplied backlink_audit.py accepts a CSV with source_url,target_url and an optional record_id. It uses the standard library, observes robots before page requests, limits response size, avoids automatic JavaScript execution, checkpoints JSON after each row and exports a CSV report.
record_id,source_url,target_url
SAMPLE001,https://pypi.org/project/requests/,https://requests.readthedocs.io
python3 backlink_audit.py audit_input.csv \
--psl public_suffix_list.dat \
--output audit_results.json
The default matches the exact URL while ignoring fragments. Scheme, path and query differences remain meaningful. --match domain matches the named host and its subdomains and is useful for discovery, but it is weaker than verifying the precise target page. --check-destination additionally requests matched destinations, with per-hop rules and limits.
Script limitations
This is an observation helper, not a browser or a full search-engine crawler. It cannot render JavaScript, solve challenges, log in, prove indexation or decide editorial quality. The utility deliberately supports a conservative robots subset. HTML/JSON responses, wildcard/end-anchor patterns, Allow rules, multiple groups and unsupported directives/rate rules stop for manual review; it is not a full RFC 9309 parser. Its DNS preflight requires ordinary public DNS resolution; the research executor's proxy-only DNS environment could not run that preflight against live hosts. Public research evidence was separately obtained through the configured HTTP proxy and official web sources. Nineteen offline tests cover parsing, robots guards, repeated headers, redirects, final-domain counting, default ports, CSV escaping and row-level errors; end-to-end live execution of the distributed utility in that environment remains unverified.
It rejects local/private addresses and credentials in URLs, but is intended as a local operator tool, not a hardened public web service. Do not deploy it as an arbitrary-URL service without a separate security design. Refresh the PSL from its official source at most once daily, retain the dated snapshot, and review terms/rate limits before any scheduled run.