Registry / communication / spf2ip

spf2ip

JSON →
library1.0.5pypypi✓ verified 80d ago

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.

pip install spf2ip
INSTALL
IMPORT
SIG · SPF2IP
S
spf2ip
communicationpythonv1.0.5
Install
2.8s avg
Import
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.0.5 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 21.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.8s · import 0.000s · 22MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SPF2IP
from SPF2IP import SPF2IP
from spf2ip import get_ip_addresses

Retrieve all IP addresses authorized by the SPF record for a domain.

from spf2ip import get_ip_addresses ips = get_ip_addresses('example.com') print(ips) # Output: {'192.0.2.1', '198.51.100.1', '2001:db8::1'}
Debug
Known issues
gotchaThe function returns a set, not a list. May cause confusion if you expect ordered results.
fix
Use sorted(ips) or list(ips) if order is needed.
affects: all
gotchaDNS lookups can be slow or fail; ensure network connectivity or handle exceptions.
fix
Wrap call in try-except for spf2ip.exceptions.DNSError or general Exception.
affects: all
gotchaSPF records with includes/macros are resolved, but recursion depth is limited; very complex SPF records may return incomplete results.
fix
Manually verify against authoritative SPF for large domains.
affects: all
Upgrade
Version history
1.0.5latest on PyPI · released Jan 19, 2018
Audit
Dependencies
dnspythonrequiredUsed for DNS lookups of SPF records
Agent activity
32 hits · last 30 days
node
30
OpenAI (training)
1
Resources
spf2ip — pip install spf2ip · libregistry