mirror of
				https://github.com/taixingyiji/openit.git
				synced 2025-11-04 14:54:05 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			14 lines
		
	
	
		
			379 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			14 lines
		
	
	
		
			379 B
		
	
	
	
		
			Python
		
	
	
	
	
	
import requests
 | 
						|
import json
 | 
						|
 | 
						|
 | 
						|
def check(alive, proxy, apiurl, sema, timeout, testurl):
 | 
						|
    try:
 | 
						|
        r = requests.get(url=apiurl + '/proxies/' + str(proxy['name']) + '/delay?url='+testurl+'&timeout=' + str(timeout), timeout=10)
 | 
						|
        response = json.loads(r.text)
 | 
						|
        if response['delay'] > 0:
 | 
						|
            alive.append(proxy)
 | 
						|
    except:
 | 
						|
        pass
 | 
						|
    sema.release()
 |