PYTHON 判断网络是否通
import urllib3 import socket from func_timeout import func_set_timeout import func_timeout,time @func_set_timeout(11) def pdwang(): try: http = urllib3.PoolManager() http.request('GET', 'https://baidu.com') return True except: return False while 1: try: aa=pdwang() except func_timeout.exceptions.FunctionTimedOut: print("异常退出") aa=False if not aa: denglu() time.sleep(600)