Reputation: 579
I wanted to know the method which you are using to make a POST
request to an API
using SCRAPY
.
Please bear with me if you think this question is not in standards of Stackoverflow.
Your help is appreciated.
I was scraping a website that shows data with the API but unfortunately, I can't scrape it.
Website: https://www.sla.org.sg/hive/sla/membershipDirectory
Upvotes: 2
Views: 338
Reputation: 2564
You need to yield a FormRequest
, the body of the request should go into formdata
parameter. Read more here.
Something like this:
api_url = 'https://www.sla.org.sg/hive/sla/membershipDirectory/search'
sample_form = {
'field1': 'value1',
'field2': 'value2',
}
yield FormRequest(url=api_url, formdata=sample_form, callback=your_parsing_method)
Upvotes: 2