美文网首页
scrapy发起payload形式的post请求

scrapy发起payload形式的post请求

作者: sexy_cyber | 来源:发表于2018-12-29 17:21 被阅读31次
                    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请求

          本文链接:https://www.haomeiwen.com/subject/rndulqtx.html