# Path: jd/proxymanager.py
# class ProxyManager(object):
#     def __init__(self):
#     def update_proxy(self, count = 100):
#     def push_proxy(self, proxy):
#     def get_proxy(self):
#     def delete_proxy(self, proxy):


import sys
import chardet
import re
import json
import datetime
import logging
import config
import utils
from scrapy import Spider
from scrapy import Request
from ..proxymanager import proxymng
                    after_content = after_content.replace('\'', '')

                    msg = {
                        'id': id,
                        'content': content,
                        'creation_time': creation_time,
                        'reply_count': reply_count,
                        'score': score,
                        'useful_vote_count': useful_vote_count,
                        'useless_vote_count': useless_vote_count,
                        'user_level_id': user_level_id,
                        'user_province': user_province,
                        'nickname': nickname,
                        'product_color': product_color,
                        'product_size': product_size,
                        'user_level_name': user_level_name,
                        'user_client': user_client,
                        'user_client_show': user_client_show,
                        'is_mobile': is_mobile,
                        'days': days,
                        'reference_time': reference_time,
                        'after_days': after_days,
                        'images_count': images_count,
                        'ip': ip,
                        'after_content': after_content,
                        'save_time': datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
                    }

                    self.sql.insert_json(msg, self.item_table)
            self.sql.commit()

# Path: jd/proxymanager.py
# class ProxyManager(object):
#     def __init__(self):
#     def update_proxy(self, count = 100):
#     def push_proxy(self, proxy):
#     def get_proxy(self):
#     def delete_proxy(self, proxy):


# Path: jd/spiders/jd_comment.py
import sys
import chardet
import re
import json
import datetime
import logging
import config
import utils
from scrapy import Spider
from scrapy import Request
from ..proxymanager import proxymng

                    after_content = after_content.replace('\'', '')

                    msg = {
                        'id': id,
                        'content': content,
                        'creation_time': creation_time,
                        'reply_count': reply_count,
                        'score': score,
                        'useful_vote_count': useful_vote_count,
                        'useless_vote_count': useless_vote_count,
                        'user_level_id': user_level_id,
                        'user_province': user_province,
                        'nickname': nickname,
                        'product_color': product_color,
                        'product_size': product_size,
                        'user_level_name': user_level_name,
                        'user_client': user_client,
                        'user_client_show': user_client_show,
                        'is_mobile': is_mobile,
                        'days': days,
                        'reference_time': reference_time,
                        'after_days': after_days,
                        'images_count': images_count,
                        'ip': ip,
                        'after_content': after_content,
                        'save_time': datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'),
                    }

                    self.sql.insert_json(msg, self.item_table)
            self.sql.commit()

            proxymng.push_proxy(response.meta.get('proxy'))