Just retyped this for the sake of improved readability. You might want to save it as /flash/lib/dnstest.py. import time import usocket import machine import _thread """ >>> import dnstest; dnstest.dns_lookup('google.com') 0 None 1 (2, 1, 0, '', ('172.217.18.14', 443)) 2 (2, 1, 0, '', ('172.217.18.14', 443)) 3 (2, 1, 0, '', ('172.217.18.14', 443)) 4 (2, 1, 0, '', ('172.217.18.14', 443)) """ response = None def run_getaddrinfo(host, port): global response response = usocket.getaddrinfo(host, port)[0] def dns_lookup(hostname, timeout=5): _thread.start_new_thread(run_getaddrinfo, (hostname, 443)) for i in range(timeout): print(i, response) machine.idle() time.sleep(1) print('Ready.') It works flawlessly over a WiFi connection, but LTE might well have its delicacies.