def process_item(self, item, spider): ret = webProxy.check_proxy(item['ip'], item['port']) if ret: return item else: raise DropItem("Duplicate item found: %s:%s" % (item['ip'], item['port']))
# python # -*- coding: utf-8 -*- # from sqlalchemy import exc from conf.config import DBSession from util import WebProxy as webProxy from model.Proxy import Proxy db = DBSession() ips = db.query(Proxy).all() for item in ips: ret = webProxy.check_proxy(item.ip, item.port) if not ret: webProxy.delete_proxy(item.ip, item.port)
def __init__(self): self.proxies = webProxy.get_proxy_list()