コード例 #1
0
 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']))
コード例 #2
0
ファイル: delProxy.py プロジェクト: zhoulinfei/ScrapyDemo
#  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)

コード例 #3
0
ファイル: pipelines.py プロジェクト: lanxinxichen/ScrapyDemo
 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']))
コード例 #4
0
 def __init__(self):
     self.proxies = webProxy.get_proxy_list()
コード例 #5
0
 def __init__(self):
     self.proxies = webProxy.get_proxy_list()