如何使用python自动浏览?

2024-04-18 22:24:16 发布

您现在位置:Python中文网/ 问答频道 /正文

假设,我需要在一个特定的网站上执行一组过程 比如,填写一些表单,单击提交按钮,将数据发送回服务器,接收响应,再次根据响应执行操作,并将数据发送回网站服务器。 我知道python中有一个web browser模块,但是我想在不调用任何web浏览器的情况下完成这项工作。必须是纯剧本。

python中有没有一个模块可以帮助我实现这一点?
谢谢


Tags: 模块数据browser服务器web表单网站过程
3条回答

你也可以看看mechanize。它的目的是处理“有状态的编程式web浏览”(根据他们的站点)。

所有的答案都是旧的,我推荐,我是requests的忠实粉丝

从主页:

Python’s standard urllib2 module provides most of the HTTP capabilities you need, but the API is thoroughly broken. It was built for a different time — and a different web. It requires an enormous amount of work (even method overrides) to perform the simplest of tasks.

Things shouldn't be this way. Not in Python.

selenium将完全按照您的要求执行,并处理javascript

相关问题 更多 >