I have a website I need to scrape and it is using jquery AJAX function to get information from the server. I have been investigating the code for a while and I successfully
BAD REQUEST 400 means that the server was unable to understand or process your request (the data you sent via AJAX).
Since you're using GET
method in AJAX, I would give a try to traditional url with query string:
var request = 'part_number=1234';
$.get('http://your.website/your_server_file?'+request, function(data){
// handle the server response (data) here ...
});
Solved it!
I added 'X-Requested-With': 'XMLHttpRequest'
to headers and did:
pn = '1234'
r = requests.get(ajaxurl + '?part_number=' + pn, headers=headers, cookies=cookies)
Did not understand why though :(