Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Mechanize::ResponseCodeError:405=>;Net::HTTPMethodNotAllowed_Ruby On Rails_Web Scraping_Mechanize - Fatal编程技术网

Ruby on rails Mechanize::ResponseCodeError:405=>;Net::HTTPMethodNotAllowed

Ruby on rails Mechanize::ResponseCodeError:405=>;Net::HTTPMethodNotAllowed,ruby-on-rails,web-scraping,mechanize,Ruby On Rails,Web Scraping,Mechanize,我正在尝试使用mechanize从url获取数据 但它给出了405个错误 url = "http://switchboard.com/business?key=habitat%20magazine&where=10001" agent.get(url) 错误: Mechanize::ResponseCodeError: 405 => Net::HTTPMethodNotAllowed for http://switchboard.com/business?key=habitat%

我正在尝试使用mechanize从url获取数据

但它给出了405个错误

url = "http://switchboard.com/business?key=habitat%20magazine&where=10001"
agent.get(url)
错误:

Mechanize::ResponseCodeError: 405 => Net::HTTPMethodNotAllowed for http://switchboard.com/business?key=habitat%20magazine&where=10001 -- unhandled response
我正在使用带有代理的mechanize代理。出现此错误的原因是什么?我检查了其他问题,但没有一个有答案