{"id":23170,"library":"spf2ip","title":"spf2ip","description":"A Python module to resolve IP addresses from an SPF (Sender Policy Framework) DNS record. Returns a set of IPv4 and IPv6 addresses for the given domain. Version 1.0.5, stable release.","status":"active","version":"1.0.5","language":"python","source_language":"en","source_url":"https://github.com/nathandines/SPF2IP","tags":["spf","dns","email","ip-address","security"],"install":[{"cmd":"pip install spf2ip","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Used for DNS lookups of SPF records","package":"dnspython","optional":false}],"imports":[{"note":"Common mistake is trying to import spf2ip as a class rather than a function.","wrong":"","symbol":"spf2ip","correct":"from spf2ip import get_ip_addresses"}],"quickstart":{"code":"from spf2ip import get_ip_addresses\n\nips = get_ip_addresses('example.com')\nprint(ips)\n# Output: {'192.0.2.1', '198.51.100.1', '2001:db8::1'}","lang":"python","description":"Retrieve all IP addresses authorized by the SPF record for a domain."},"warnings":[{"fix":"Use sorted(ips) or list(ips) if order is needed.","message":"The function returns a set, not a list. May cause confusion if you expect ordered results.","severity":"gotcha","affected_versions":"all"},{"fix":"Wrap call in try-except for spf2ip.exceptions.DNSError or general Exception.","message":"DNS lookups can be slow or fail; ensure network connectivity or handle exceptions.","severity":"gotcha","affected_versions":"all"},{"fix":"Manually verify against authoritative SPF for large domains.","message":"SPF records with includes/macros are resolved, but recursion depth is limited; very complex SPF records may return incomplete results.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run: pip install spf2ip","cause":"Library not installed","error":"ModuleNotFoundError: No module named 'spf2ip'"},{"fix":"Use: from spf2ip import get_ip_addresses","cause":"Incorrect import (e.g., 'import spf2ip' then calling spf2ip.get_ip_addresses)","error":"AttributeError: module 'spf2ip' has no attribute 'get_ip_addresses'"},{"fix":"Check domain has valid SPF record and ensure DNS is reachable.","cause":"Domain has no SPF record or network is down","error":"spf2ip.exceptions.DNSError: DNS resolution failed"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}