scrapy发送post请求

    def next_requests(self):
            body ={"count":24,"ff":"share","need":False,"sourceFrom":1,"request":1,"fontId":153}

            headers = {
                'User-Agent': 'Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Mobile Safari/537.36',
                'Content-Type': 'application/json; charset=UTF-8',
            }
            yield Request(
                url=self.seed_url, headers=headers, body=json.dumps(body), method='POST', callback=self.parse,
                dont_filter=True
            )
posted @ 2020-10-28 16:33  公众号python学习开发  阅读(150)  评论(0编辑  收藏  举报