tcping
tcping copied to clipboard
by pinging a hostname instead of an IP, errors do not count as "failed"
When I ping a hostname, which can not be resolved, I get this error:
>>> ping.ping(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/tcping.py", line 171, in ping
((self._host, self._port), None))
File "/usr/local/lib/python3.6/dist-packages/tcping.py", line 108, in cost
func(*arg)
File "/usr/local/lib/python3.6/dist-packages/tcping.py", line 45, in connect
self._s.connect((host, int(port)))
socket.gaierror: [Errno -2] Name or service not known
However, this does not count as failed:
>>> ping._failed
0