How to flush cache for socket.gethostbyname response?

Viewed 13316

Anyone run into this before:

After updating DNS records..I do a dig for 'test.somedomain.com' I get 167.69.143.234, however when I do a socket.gethostbyname('test.somedomain.com') I get 167.69.6.234.

I'm guessing socket is still using cache...how do I clear it ? or flush it?

My code is very simple:

Linux Termianl

dig test.somedomain.com

Python:

import socket
socket.gethostbyname('test.somedomain.com')

It should be returning the 167.69.143.234 address as that is the updated one in DNS.

2 Answers
Related