Published | Last Update
212 views, 0 RAMs, and 0 comments
Self explanatory, mostly.
import Queue from threading import Thread, active_count import time que = Queue.Queue() threads = list() for p in proxy_arr: t = Thread( target=lambda q, p, url_for_test : q.put(proxy_obj_init(p, url_for_test)), args=(que, p, url_for_test )) threads.append(t) t.start() # Wait for all proxies to finish testing for index, thread in enumerate(threads): thread.join()
With Thread Monitor
import Queue from threading import Thread, active_count import time que = Queue.Queue() threads = list() for p in proxy_arr: t = Thread( target=lambda q, p, url_for_test : q.put(proxy_obj_init(p, url_for_test)), args=(que, p, url_for_test )) threads.append(t) t.start() # Wait for all proxies to finish testing # active_count() includes the main thread, so if there are no remaining threads, # it will return 1 (not 0) # rjust is used to make sure the string is the same length on each write, # Otherwise, there may be characters that are not cleared from the previous loop while ( active_count() > 1 ): sys.stdout.write("> Waiting on " + str(active_count()).rjust(5, " ") + " proxy threads to finish...\r" ) sys.stdout.flush() time.sleep(0.5)
Sir, I can do you a nice SEO.
Post a New Comment
Do you like having a good time?
Register an Account
Read Quality Articles
Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.
Argue with People on the Internet
Use your account to explain why people are wrong on the Internet forum.
Vandalize the Wiki
Or don't. I'm not your dad.
Ask and/or Answer Questions
If someone asks a terrible question, post a LMGTFY link.
Make Some Money
Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.
Answers— Read More
Find more related content below!
- [BASH, cURL] Yellow Pages Scraper: Fully Functional Script with Source Code
- [cURL, BASH] How to Crawl and Scrape DuckDuckGo Search Results
- The Basics to Web Scraping with cURL and XPath
- Extracting Emails from HTML with Google Sheets: Get Contact Information in Bulk for Guest Posts, (lmao) 404 Re...
- [Infographic] The Beginner's SQLite Cheat Sheet
- Analyzing the Web: Downloading the Majestic Million, Setting up SQLite, Crawling the Web, and Generating Repor...
- Downloading Bulk Images: ThisPersonDoesNotExist with Python and urllib2
- Spit in the Face of God: Five Tasks You Didn’t Know Could be Done with Google Sheets
- An introduction to scraping with Python and BeautifulSoup