[英]Python get request and retrieving data from search
I'm trying to use the requests module to retrieve data from this website: https://toelatingen.ctgb.nl/ 我正在尝试使用请求模块从以下网站检索数据: https : //toelatingen.ctgb.nl/
I want to receive the found data when I put in "11462" the "Zoekterm" field for example. 例如,当我在“ Zoekterm”字段中输入“ 11462”时,我想接收找到的数据。
data = { "searchTerm": "11462"}
session = requests.Session()
r = session.post('https://toelatingen.ctgb.nl/',data=data)
body_data = r.text
The content of the body_data does not, unfortunately, contain the information searched for. 不幸的是,body_data的内容不包含所搜索的信息。
Thanks for helping me. 谢谢你帮我
The reason you're not getting the response data is because the site doesn't do the search at that url. 您没有获得响应数据的原因是因为该站点未在该URL上进行搜索。 Instead it makes a call to https://toelatingen.ctgb.nl/nl/admissions/overview .
而是调用https://toelatingen.ctgb.nl/nl/admissions/overview 。
When you're trying to get information off the internet the first thing you want to do is check how your web browser is getting the data. 当您尝试从Internet上获取信息时,您要做的第一件事是检查Web浏览器如何获取数据。 If you open up whatever inspection tool comes with your browser of choice (typically the hotkey is ctrl+shift+i), you should be able to find a Network tab that tracks the requests and responses the browser makes.
如果打开所选浏览器随附的任何检查工具(通常热键为ctrl + shift + i),则应该能够找到一个“网络”选项卡,该选项卡可跟踪浏览器发出的请求和响应。 Once you have that open, get your browser to display the information you want and watch the Network Tab while it's doing so.
打开后,让您的浏览器显示所需的信息,并在其中查看“网络”选项卡。 Check whatever responses come up to find the one that has the information you want and then replicate the request your browser used.
检查出现的任何响应以找到具有所需信息的响应,然后复制浏览器使用的请求。
In your case: 在您的情况下:
requests
module returns the same json. requests
模块是否返回相同的json。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.