Python 使用非JSON格式的表单数据删除ajax调用
我在Python方面的经验有限,我正在努力打造一个使用ajax调用的网站。我已经尝试了在不同的网站上提供的示例,但是我还没有成功,很可能是因为我的ajax调用的表单数据没有格式化为JSON 本例中的ajax调用具有以下格式的表单数据:Python 使用非JSON格式的表单数据删除ajax调用,python,ajax,python-3.x,web-scraping,Python,Ajax,Python 3.x,Web Scraping,我在Python方面的经验有限,我正在努力打造一个使用ajax调用的网站。我已经尝试了在不同的网站上提供的示例,但是我还没有成功,很可能是因为我的ajax调用的表单数据没有格式化为JSON 本例中的ajax调用具有以下格式的表单数据: filters[targetValueMin]: 0 filters[targetValueMax]: 15000000 filters[interestRateMin]: 0 filters[interestRateMax]: 20 filters[loanTe
filters[targetValueMin]: 0
filters[targetValueMax]: 15000000
filters[interestRateMin]: 0
filters[interestRateMax]: 20
filters[loanTermMin]: 0
filters[loanTermMax]: 240
filters[platforms]:
filters[financingTypes]:
filters[developmentPhases]:
filters[investmentPurposes]:
因此,我的问题是:如何从这个ajax调用中获取内容
可以通过转到并调整左侧的一个过滤器来重新创建ajax调用 签入请求文档以发送表单url编码数据。然后解析json结果:
import requests
payload = {
'filters[routeName]' : 'projects_list',
'filters[pageNr]' : '1',
'filters[funded]' : '1',
'filters[targetValueMin]' : '0',
'filters[targetValueMax]' : '15000000',
'filters[interestRateMin]' : '0',
'filters[interestRateMax]' : '20',
'filters[loanTermMin]' : '0',
'filters[loanTermMax]' : '240',
'filters[platforms]' : '',
'filters[financingTypes]' : '',
'filters[developmentPhases]' : '',
'filters[investmentPurposes]' : '',
'filters[businessEntities]' : '',
'filters[states]' : '',
'filters[sectors]' : '',
'filters[search]' : ''
}
r = requests.post("https://www.crowdfundmarkt.nl/crowdfundingprojecten/ajax-fetch", data=payload)
print r.json()