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:
JavaScript
x
40
40
1
import requests
2
3
cookies = {
4
'e44cd683218d4334fdd9a0a70f77718b': '70e21e527a02d22cbd7c74f423b00666',
5
'cookieconsent_status': 'allow',
6
'_gcl_au': '1.1.1044858313.1660121622',
7
}
8
9
headers = {
10
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:103.0) Gecko/20100101 Firefox/103.0',
11
'Accept': '*/*',
12
'Accept-Language': 'en-US,en;q=0.5',
13
# 'Accept-Encoding': 'gzip, deflate, br',
14
'Referer': 'https://global-standard.org/find-suppliers-shops-and-inputs/certified-suppliers/database/search_results?total=9461',
15
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
16
'X-Requested-With': 'XMLHttpRequest',
17
'Origin': 'https://global-standard.org',
18
'Connection': 'keep-alive',
19
# Requests sorts cookies= alphabetically
20
# 'Cookie': 'e44cd683218d4334fdd9a0a70f77718b=70e21e527a02d22cbd7c74f423b00666; cookieconsent_status=allow; _gcl_au=1.1.1044858313.1660121622',
21
'Sec-Fetch-Dest': 'empty',
22
'Sec-Fetch-Mode': 'cors',
23
'Sec-Fetch-Site': 'same-origin',
24
}
25
26
params = {
27
'task': 'xforms_get_items',
28
'context': 'search',
29
}
30
31
data = {
32
'condition': '',
33
'order': '',
34
'limit': '10',
35
'page': '0',
36
'pageChanged': 'false',
37
}
38
39
response = requests.post('https://global-standard.org/find-suppliers-shops-and-inputs/certified-suppliers/database/search', params=params, cookies=cookies, headers=headers, data=data)
40
Let say I want to send POST request with next data
JavaScript
1
8
1
data = {
2
'condition': '',
3
'order': '',
4
'limit': '50',
5
'page': '3',
6
'pageChanged': 'false',
7
}
8
Advertisement
Answer
Nevermind, they provided option to request all data from list!
so that my code worked