2024-10-03 00:27:41 发布
网友
我刚刚开始研究Python。在
站点:http://toolserver.org/~diberri/cgi-bin/html2wiki/index.cgi
机器人有没有可能把数据放在顶部的框中,或者勾选一个框或其他什么,然后点击底部的“转换”按钮?在
哦,还有,在选项标题下,有一个框,你可以选择各种选项。你到底是怎么让机器人选择其中一个的呢?在
谢谢
当然你可以,但是你不会用你的机器人输入HTML代码。如果您查看页面的源代码,您将看到:
<form method="post" action="index.cgi"> <fieldset style="display:none"> <input type="hidden" name="m" value="convert" /> </fieldset> ...
它确实说明表单使用post方法传递到这个uri:http://toolserver.org/~diberri/cgi-bin/html2wiki/index.cgi
现在您可以看看urllib2,urllib2,这是http请求的python库。并使用所需参数创建post请求。在
例如:
您将需要一个标头,告诉服务器谁在执行请求:
headers = {"Content-type": "application/x-www-form-urlencoded", "Accept": "text/plain"}
像这样:
u = urllib2.urlopen(' http://toolserver.org/~diberri/cgi-bin/html2wiki/index.cgi', params) h.request('POST', ' http://toolserver.org/~diberri/cgi-bin/html2wiki/index.cgi', params, headers)
当然你可以,但是你不会用你的机器人输入HTML代码。如果您查看页面的源代码,您将看到:
它确实说明表单使用post方法传递到这个uri:http://toolserver.org/~diberri/cgi-bin/html2wiki/index.cgi
现在您可以看看urllib2,urllib2,这是http请求的python库。并使用所需参数创建post请求。在
例如:
^{pr2}$您将需要一个标头,告诉服务器谁在执行请求:
例如:
像这样:
相关问题 更多 >
编程相关推荐