【发布时间】:2016-07-21 06:31:01
【问题描述】:
我必须使用不同的 ip 地址打开同一个网站,以便使用 python 进行网页抓取。我没有关于网页抓取的详细知识。我在下面尝试过,但我不明白。这个的详细代码是什么???
def connectToSiteFunction(ip):
# your code to bind ip (if it's a source) or connect to it (if it's a dst)
# and do your thing here
def connectAndWait():
for ip in ips:
t = threading.Thread(target=connectToSiteFunction, args=(ip,))
yield t
t.start()
os.sleep(15)
threads = [t for t in connectAndWait()]
for t in threads:
t.join()
提前致谢
【问题讨论】:
标签: python-2.7 selenium-webdriver web-scraping