Hi, I am logging in to one site and experiencing no trouble getting a form filled in a clicking a submit. I am trying a second site now, and it is not working. I am getting a 403 => Net::HTTPForbidden /Library/Ruby/Gems/1.8/gems/mechanize-1.0.0/lib/mechanize.rb:259:in `get'' The page is not protected as it is a login page I am doing the get command on. agent = Mechanize.new page = agent.get("http://www.tirerackwholesale.com/whlogin/Login.jsp") pp page I am not sure why this page is returning a 403? Is there a convenient way to get more information about the exact cause of the get failure?? Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20100504/70b3569e/attachment.html>
hey, you need to set the user agent: a = Mechanize.new { |agent| agent.user_agent_alias = ''Mac Safari''} page = a.get("http://www.tirerackwholesale.com/whlogin/Login.jsp") On May 4, 2010, at 9:28 PM, Dave Lazar wrote:> Hi, > > I am logging in to one site and experiencing no trouble getting a form filled in a clicking a submit. > > I am trying a second site now, and it is not working. I am getting a 403 => Net::HTTPForbidden > /Library/Ruby/Gems/1.8/gems/mechanize-1.0.0/lib/mechanize.rb:259:in `get'' > > The page is not protected as it is a login page I am doing the get command on. > > agent = Mechanize.new > page = agent.get("http://www.tirerackwholesale.com/whlogin/Login.jsp") > pp page > > I am not sure why this page is returning a 403? > > Is there a convenient way to get more information about the exact cause of the get failure?? > > Thanks > > > _______________________________________________ > Mechanize-users mailing list > Mechanize-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mechanize-users-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20100504/d06c3ea3/attachment.html>
Hi, Awesome! Thanks!! I did not suspect the User Agent would result in that problem. Dave On Tue, May 4, 2010 at 4:13 PM, Mihael <miha.ploha at gmail.com> wrote:> hey, > > you need to set the user agent: > > a = Mechanize.new { |agent| agent.user_agent_alias = ''Mac Safari''} > page = a.get("http://www.tirerackwholesale.com/whlogin/Login.jsp") > > > On May 4, 2010, at 9:28 PM, Dave Lazar wrote: > > Hi, > > I am logging in to one site and experiencing no trouble getting a form > filled in a clicking a submit. > > I am trying a second site now, and it is not working. I am getting a 403 => > Net::HTTPForbidden > /Library/Ruby/Gems/1.8/gems/mechanize-1.0.0/lib/mechanize.rb:259:in `get'' > > The page is not protected as it is a login page I am doing the get command > on. > > agent = Mechanize.new > page = agent.get("http://www.tirerackwholesale.com/whlogin/Login.jsp") > pp page > > I am not sure why this page is returning a 403? > > Is there a convenient way to get more information about the exact cause of > the get failure?? > > Thanks > > > _______________________________________________ > Mechanize-users mailing list > Mechanize-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mechanize-users > > > > _______________________________________________ > Mechanize-users mailing list > Mechanize-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/mechanize-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/mechanize-users/attachments/20100504/1dc857ce/attachment-0001.html>