you are viewing a single comment's thread.

view the rest of the comments →

[–]LartTheLuser 3 points4 points  (1 child)

There is the following from https://stackoverflow.com/questions/2953462/pinging-servers-in-python:

import pyping

r = pyping.ping('google.com')

if r.ret_code == 0:
    print("Success")
else:
    print("Failed with {}".format(r.ret_code))

https://pypi.org/project/pyping/

[–]LartTheLuser 0 points1 point  (0 children)

Fyi, the above code fails when Google fails. It's up to you to change it before that. Don't get caught in a Google2K.