import robotparser rp = robotparser.RobotFileParser() rp.set_url('url/robot.txt') rp.read()
user_agent = 'Spider' rp.can_fetch(user_agent, url)
Boolean变量可以检测代理是否可以爬取
import robotparser rp = robotparser.RobotFileParser() rp.set_url('url/robot.txt') rp.read()
user_agent = 'Spider' rp.can_fetch(user_agent, url)
Boolean变量可以检测代理是否可以爬取