Sending an jquery AJAX GET request with Python request library

后端 未结 2 1983
暖寄归人
暖寄归人 2021-01-03 07:10

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

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-03 07:54

    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 :(

提交回复
热议问题