# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://docs.scrapy.org/en/latest/topics/item-pipeline.html
import logging

from util import json_util, service_client


class ReptilePipeline(object):

    def process_item(self, item, spider):
        obj = dict(item)
        logging.info("Upload goods, {}".format(json_util.obj2json(obj)))
        service_client.upload_goods(obj)

    def close_spider(self, spider):
        logging.info("close spider")
