简体   繁体   English

如何通过python从网页中获取数据?

[英]How to get data from web page by python?

On webpage http://baza.ue.poznan.pl/ there are two inputs for surname and name of workers and search button.在网页http://baza.ue.poznan.pl/上有两个输入,用于输入工人的姓氏和姓名以及搜索按钮。 I want get all workers data automatically by python script.我想通过 python 脚本自动获取所有工人数据。 I don't have any experience with webdev.我对 webdev 没有任何经验。 Could you give me any advice how I can do it in the best way?你能给我任何建议,我怎样才能以最好的方式做到这一点?

Please look at python request library for http requests:请查看http请求的python请求库:

http://docs.python-requests.org/ http://docs.python-requests.org/

To parse the html response checkout:要解析 html 响应结帐:

https://www.crummy.com/software/BeautifulSoup/bs4/doc/ https://www.crummy.com/software/BeautifulSoup/bs4/doc/

When you enter surname and name in the webpage and press enter,当您在网页中输入姓氏和姓名并按回车键时,

the page send a post request to http://baza.ue.poznan.pl/index.php with form-data conataining these details(check out the network tab in developer tools in browser)该页面向http://baza.ue.poznan.pl/index.php发送一个 post 请求,其中包含包含这些详细信息的表单数据(查看浏览器中开发人员工具中的网络选项卡)

The response this page gets is html which is displayed by your browser.此页面获得的响应是​​由您的浏览器显示的 html。

You can parse this response using BeautifulSoup to obtain worker's data您可以使用 BeautifulSoup 解析此响应以获取工作人员的数据

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM