from grab import Grab import threading import random import time def test_proxy(proxy): grab = Grab(url = 'https://api.ipify.org?format=json', connect_timeout = 10, proxy = proxy, proxy_type = 'socks5') try: grab.request() print(grab.response.unicode_body()) except Exception as e: print(e) proxyList = Grab().go('http://api.best-proxies.ru/feeds/proxylist.txt?key=01YvxflHzjs4eyNvDhtrdeoU&type=socks5&limit=0').unicode_body().split('\r\n') for i in range(50): threading.Thread(target= test_proxy, args= [random.choice(proxyList)]).start() while threading.active_count() > 1: time.sleep(1)
from grab import Grab import threading import random import time def test_proxy(proxy): grab = Grab(url = 'https://api.ipify.org?format=json', connect_timeout = 10, proxy = proxy, proxy_type = 'http') try: grab.request() print(grab.response.unicode_body()) except Exception as e: print(e) proxyList = Grab().go('http://api.best-proxies.ru/feeds/proxylist.txt?key=01YvxflHzjs4eyNvDhtrdeoU&type=https&limit=0').unicode_body().split('\r\n') for i in range(50): threading.Thread(target= test_proxy, args= [random.choice(proxyList)]).start() while threading.active_count() > 1: time.sleep(1)
Питон изучаю недавно.