MCPcopy Create free account
hub / github.com/SpyGuard/SpyGuard / check_internet

Method check_internet

analysis/classes/engine.py:657–677  ·  view source on GitHub ↗

Check the internet link just with a small http request to an URL present in the configuration. If the link is down, retry 3 times. Returns: bool: True if everything works.

(self)

Source from the content-addressed store, hash-verified

655 return ""
656
657 def check_internet(self) -> bool:
658 """Check the internet link just with a small http request
659 to an URL present in the configuration. If the link is down,
660 retry 3 times.
661
662 Returns:
663 bool: True if everything works.
664 """
665 attempts = 3
666
667 while True:
668 try:
669 url = get_config(("network", "internet_check"))
670 requests.get(url, timeout=3)
671 return True
672 except:
673 if attempts == 0:
674 return False
675 else:
676 time.sleep(5)
677 attempts -= 1
678
679 def get_public_ip(self) -> list:
680 """Get the public IP address

Callers 1

__init__Method · 0.95

Calls 2

get_configFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected