コード例 #1
0
#QQ     : 324858038
#Blog   : http://blog.csdn.net/xueshijun666
#Created on Sun Mar 06 13:51:34 2016
#Version: 1.0
#-------------------------------------------------------------------------------
from bs4 import BeautifulSoup

from dbconnection import DB 
import tools as mytools
import urllib
import random
import time
import ips as ips

proxylist =  ips.proxylist
db=DB() 
i=400277
step =2
while(i<500300):
    author_list = db.get_author(i,step)
    if(len(author_list)>0):
        for row in author_list:
            error_log =""
            try: 
                print '--------------------------------------------------------------------------------'
                error_log = "%s,%s,%s" % (row['id'],row['author'],row['href'])        
    #            print "error_log:::",error_log 
                '''=====================代理模式===========================  '''  
                proxy = proxylist[random.randint(0,len(proxylist)-1)]
                print "***********************************************************"
                print proxy
#QQ     : 324858038
#Blog   : http://blog.csdn.net/xueshijun666
#Created on Sun Mar 06 13:51:34 2016
#Version: 1.0
#-------------------------------------------------------------------------------
from bs4 import BeautifulSoup

from dbconnection import DB 
import tools as mytools
import urllib
import random
import time
import ips as ips

proxylist =  ips.proxylist
db=DB() 
i=900000
step =1
while(i<1000300):
    author_list = db.get_author(i,step)
    if(len(author_list)>0):
        for row in author_list:
            error_log =""
            try: 
                print '--------------------------------------------------------------------------------'
                error_log = "%s,%s,%s" % (row['id'],row['author'],row['href'])        
    #            print "error_log:::",error_log 
                '''=====================代理模式===========================  '''  
                proxy = proxylist[random.randint(0,len(proxylist)-1)]
                print "***********************************************************"
                print proxy