We can use scrapy.FormRequest
send post request with parameters.
import scrapy
class ExampleSpider(scrapy):
name = 'ExampleSpider'
allowed_domains = ['example.com']
def start_requests(self):
params = {
'parameter1': 'value1',
'parameter2': 'value2',
}
yield scrapy.FormRequest('api.example.com', callback=self.parse,
method='POST', formdata=params)
def parse(self, response):
pass
Hey, guys. Here is the problems I met. I wanna to send a post request, which has both form and params. Like this:
urls = 'https://www.xxx.com/'
params = {"args1":"aaa","args2":"bbb"}
body ={"key":"value"}
As mentioned, we may find the example in the explorer like this:
https://www.xxx.com/?args1=aaa&args2=bbb, with post method and body {"key":"value"}
how should i write in the scrapy?