I am trying to get the responses from server and save this response to json files. The problem is that I cannot request custom data, even if I try to change some parameters, nothing works.
Here is my code:
import requests
cookies = {
'e44cd683218d4334fdd9a0a70f77718b': '70e21e527a02d22cbd7c74f423b00666',
'cookieconsent_status': 'allow',
'_gcl_au': '1.1.1044858313.1660121622',
}
headers = {
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0',
'Accept': '*/*',
'Accept-Language': 'en-US,en;q=0.5',
# 'Accept-Encoding': 'gzip, deflate, br',
'Referer': 'https://global-standard.org/find-suppliers-shops-and-inputs/certified-suppliers/database/search_results?total=9461',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'X-Requested-With': 'XMLHttpRequest',
'Origin': 'https://global-standard.org',
'Connection': 'keep-alive',
# Requests sorts cookies= alphabetically
# 'Cookie': 'e44cd683218d4334fdd9a0a70f77718b=70e21e527a02d22cbd7c74f423b00666; cookieconsent_status=allow; _gcl_au=1.1.1044858313.1660121622',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
}
params = {
'task': 'xforms_get_items',
'context': 'search',
}
data = {
'condition': '',
'order': '',
'limit': '10',
'page': '0',
'pageChanged': 'false',
}
response = requests.post('https://global-standard.org/find-suppliers-shops-and-inputs/certified-suppliers/database/search', params=params, cookies=cookies, headers=headers, data=data)
Let say I want to send POST request with next data
data = {
'condition': '',
'order': '',
'limit': '50',
'page': '3',
'pageChanged': 'false',
}
CodePudding user response:
I believe 'limit' and 'page' value is what you want to change and pass as a payload, so just give it some variables line 'a' or 'b' and pass 'a' or 'b' in place of '50' and '3' thats It.
CodePudding user response:
Nevermind, they provided option to request all data from list!
so that my code worked