2015-05-04 117 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

回答