Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from threading import Thread
- import requests
- with open('working-proxies-history.txt') as f:
- proxy_list = [f'http://{proxy}' for proxy in f.read().split()]
- def fetch(proxy: str):
- try:
- requests.get('http://icanhazip.com', proxies={
- 'http': proxy,
- 'https': proxy
- }, timeout=6).text
- except:
- pass
- else:
- results.append(True)
- step = 400
- count = 0
- results = []
- for i in range(0, len(proxy_list), step):
- threads = []
- for proxy in proxy_list[i:i + step]:
- thread = Thread(target=fetch, args=(proxy,))
- thread.start()
- threads.append(thread)
- for thread in threads:
- thread.join()
- count += results.count(True)
- print(count)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement