def isconnected(ping_url): """Whether the client application is connected to the Internet.""" try: head_request(ping_url) return True except NetworkError: return False
def isready(ping_url): """Whether the server is ready to receive synchronization requests.""" try: code, reason = head_request(ping_url) return code // 100 == 2 except: return False