efl.ecore_con.Lookup
Class¶
- class efl.ecore_con.Lookup(name, done_cb, *args, **kargs)¶
Bases:
object
A simple class to perform asynchronous DNS lookups.
- Parameters
name (string) – The hostname to query
done_cb (callable) – The function to call when done
*args – Any other arguments will be passed back in
done_cb
**kargs – Any other keywords arguments will be passed back in
done_cb
New in version 1.17.
Just create an instance and give a callback function to be called when the operation is complete.
This class performs a DNS lookup on the hostname specified by name, then calls done_cb with the result and the data given as parameter. The result will be given to the done_cb as follows:
expected `done_cb` signature:
func(canonname, ip, sockaddr)
- where:
canonname (string) is the canonical domain name
ip (string) is the recolved ip address
sockaddr (None) is a placeholder for future expansion
Usage example:
import ecore_con def done_cb(canonname, ip, sockaddr): print(canonname) print(ip) ecore_con.Lookup('example.com', done_cb)