2015-05-04 76 views
1

我有一个约100,000个链接的列表,我想检查HTTP响应代码。什么可能是最好的方法来进行检查编程?100,000 HTTP响应代码检查

我使用下面的Python代码考虑:

import requests 
try: 
    for x in range(0, 100000): 
    r = requests.head(''.join(["http://stackoverflow.com/", str(x)])) 
    # They'll actually be read from a file, and aren't sequential 
    print r.status_code 
except requests.ConnectionError: 
    print "failed to connect" 

..但我不知道在一个单一的取检查等一大批网址的潜在副作用。思考?

+1

找到了答案[这里](http://stackoverflow.com/questions/2632520/what-is-the-fastest-way-to-send-100-000-http-requests-in-python)到完全相同的问题! – FloatingRock

回答