The requests
library does not get the IP address directly. Instead, it uses urllib3
under the hood, which in turn uses other Python libraries http.client
and socket
libraries to obtain the IPs and establish the connection. If the domain has multiple IPs, Python typically tries the first one returned.