From: saronpasu Date: 2008-03-16T12:27:21+09:00 Subject: Re: WWW::Mechanize and basic_auth ------=_Part_3105_9103757.1205638051718 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Todd. "WWW::Mechanize#auth" is not basic authentication method. Please try again by using "WWW::Mechanize#basic_auth" for basic authentication. require 'mechanize' agent = WWW::Mechanize.new agent.basic_auth('foo', 'bar') agent.get('http://192.168.20.10' ) 2008/3/16, Todd A. Jacobs : > > I'm trying to get basic authentication to work with Ruby 1.8 and > WWW::Mechanize 0.7, and am having no luck: > > require 'mechanize' > agent=WWW::Mechanize.new > agent.auth('foo', 'bar') > agent.get('http://192.168.20.10') > > I get the following error: > > WWW::Mechanize::ResponseCodeError: 401 => Net::HTTPUnauthorized > > Yes, I'm using the correct username and password. I can log in properly > via Firefox, just not with mechanize. How do I get basic authentication > to work in this instance? > > > -- > "Oh, look: rocks!" > -- Doctor Who, "Destiny of the Daleks" > > > ------=_Part_3105_9103757.1205638051718--