【发布时间】:2016-04-02 16:22:23
【问题描述】:
我正在尝试通过 Ruby 或 Python 为以下网站上的表单发出 POST 请求: http://diamond-cut.com.au/holloway_cut_adviser.htm
请求返回“无数据”。我想我在请求标头中省略了某些内容(例如,用户代理、接受。包括这些参数并没有改变结果)
在 Ruby 中返回“无数据”的最少代码:
require 'restclient'
url='http://www.pricescope.com/hca.php'
params = {"depth_textbox" => '60',
"table_textbox" => '57',
"crown_listbox" => "0",
"crown_textbox" => '34',
"pavilion_listbox" => "0",
"pavilion_textbox" => '40.5',
"cutlet_textbox" => "0"}
page=RestClient.post(url,params)
在 Python 中:
import requests
url='http://www.pricescope.com/hca.php'
params = {"depth_textbox" : '60',
"table_textbox" : '57',
"crown_listbox" : "0",
"crown_textbox" : '34',
"pavilion_listbox" : "0",
"pavilion_textbox" : '40.5',
"cutlet_textbox" : "0"}
r=requests.post(url,params)
【问题讨论】:
标签: python ruby post web-scraping python-requests