# 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
                  'pageSize=10&isShadowSku=0'. \
                format(product_id = data.get('product_id'), comment_version = data.get('comment_version'),
                       sort_type = data.get('sort_type'), page = data.get('page'))

            # self.log(url)
            yield Request(
                    url = url,
                    headers = {
                        'Accept': '*/*',
                        'Accept-Encoding': 'gzip, deflate, br',
                        'Accept-Language': 'en-US,en;q=0.5',
                        'Connection': 'keep-alive',
                        'Host': 'club.jd.com',
                        'Referer': 'https://item.jd.com/%s.html' % self.product_id,
                        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 '
                                      'Firefox/52.0',
                    },
                    method = 'GET',
                    meta = {
                        'page': data.get('page'),
                        'is_proxy': config.is_proxy,
                        'handle_httpstatus_list': [302, 403, 301, 404, 500, 405, 502],
                        'info': info
                    },
                    dont_filter = True,
                    callback = self.parse_comment,
                    errback = self.error_request,
            )

    def parse_comment(self, response):

# 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

                  'pageSize=10&isShadowSku=0'. \
                format(product_id = data.get('product_id'), comment_version = data.get('comment_version'),
                       sort_type = data.get('sort_type'), page = data.get('page'))

            # self.log(url)
            yield Request(
                    url = url,
                    headers = {
                        'Accept': '*/*',
                        'Accept-Encoding': 'gzip, deflate, br',
                        'Accept-Language': 'en-US,en;q=0.5',
                        'Connection': 'keep-alive',
                        'Host': 'club.jd.com',
                        'Referer': 'https://item.jd.com/%s.html' % self.product_id,
                        'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 '
                                      'Firefox/52.0',
                    },
                    method = 'GET',
                    meta = {
                        'page': data.get('page'),
                        'is_proxy': config.is_proxy,
                        'handle_httpstatus_list': [302, 403, 301, 404, 500, 405, 502],
                        'info': info
                    },
                    dont_filter = True,
                    callback = self.parse_comment,
                    errback = self.error_request,
            )

    def parse_comment(self, response):

        self.save_page('%s_%s.html' % (self.product_id, response.meta.get('page')), response.body)