scrapy发起payload形式的post请求

                headers={'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36',
                         'Referer':Referer,
                         'Content-Type':'application/json;charset=UTF-8',
                         '5c4d8797ab7576ce2339':'299fa9ae437bcd55403d6f6ef4d06a7a9270cc0b28c9b60a77f52ddc2b19b583c8f4215cc385ef7c4f3fef6097d91dc723f89d3c4f9b9768b2685a190c41400a'}

                payload={"area":{"province":"31"},"key":brand,"page":i}

                yield scrapy.Request(url=url,
                                     method='POST',
                                     body=json.dumps(payload),
                                     headers=headers,
                                     cookies=random.choice(allcookie),
                                     meta={'brand':brand,'url':url},
                                     callback=self.index,
                                     dont_filter=True)


你可能感兴趣的:(scrapy发起payload形式的post请求)