Thanks for response I am still having some problems now its the 403.
Manually I can login with no probems, but there is a popup page to enter
username and password. How do I process the username popup?
require ''mechanize''
require ''logger''
CP_LOGGER = Logger.new( ''cp.log'' )
CP_LOGGER.level = Logger::INFO
agent = WWW::Mechanize.new {|a| a.log = Logger.new(STDERR) }
agent.basic_auth(''username'', ''password'')
page = agent.get(''https://'' )
>ruby mechanize_altell.rb
I, [2007-07-12T12:42:11.718000 #400] INFO -- : Net::HTTP::Get: /developer/
D, [2007-07-12T12:42:13.375000 #400] DEBUG -- : request-header:
accept-language => en-us,en;q0.5
D, [2007-07-12T12:42:13.375000 #400] DEBUG -- : request-header: connection
=> keep-alive
D, [2007-07-12T12:42:13.375000 #400] DEBUG -- : request-header: accept =>
*/*
D, [2007-07-12T12:42:13.375000 #400] DEBUG -- : request-header:
accept-encoding => gzip,identity
D, [2007-07-12T12:42:13.375000 #400] DEBUG -- : request-header: user-agent
=> WWW-Mechanize/0.6.8 (http://rubyforge.org/projects/mechanize/)
D, [2007-07-12T12:42:13.375000 #400] DEBUG -- : request-header:
authorization => Basic anl1QGdvdHZuZXR3b3Jrcy5jb206Z290dnJvY2tz
D, [2007-07-12T12:42:13.375000 #400] DEBUG -- : request-header:
accept-charset => ISO-8859-1,utf-8;q=0.7,*;q=0.7
D, [2007-07-12T12:42:13.375000 #400] DEBUG -- : request-header: keep-alive
=> 300
D, [2007-07-12T12:42:13.515000 #400] DEBUG -- : Read 0 bytes
D, [2007-07-12T12:42:13.515000 #400] DEBUG -- : Read 726 bytes
D, [2007-07-12T12:42:13.515000 #400] DEBUG -- : response-header: connection
=> Keep-Alive
D, [2007-07-12T12:42:13.515000 #400] DEBUG -- : response-header:
content-type => text/html; charset=iso-8859-1
D, [2007-07-12T12:42:13.515000 #400] DEBUG -- : response-header: date =>
Thu, 12 Jul 2007 19:42:20 GMT
D, [2007-07-12T12:42:13.515000 #400] DEBUG -- : response-header: server =>
IBM_HTTP_Server
D, [2007-07-12T12:42:13.515000 #400] DEBUG -- : response-header:
content-length => 726
D, [2007-07-12T12:42:13.515000 #400] DEBUG -- : response-header: keep-alive
=> timeout=10, max=100
I, [2007-07-12T12:42:13.531000 #400] INFO -- : status: 403
c:/ruby/lib/ruby/gems/1.8/gems/mechanize-0.6.8/lib/mechanize.rb:172:in
`get'': 403 => Net::HTTPForbidden (WWW::Mechanize::ResponseCodeError)
from mechanize_altell.rb:13>Exit code: 1
On 7/11/07, Aaron Patterson <aaron at tenderlovemaking.com>
wrote:>
> On Wed, Jul 11, 2007 at 07:47:58PM -0700, jeffrey mclurkin wrote:
> > How do you make get the page when using basic_auth? Below is code, I
am
> > getting a 401 error. I am not sure if the basic _auth comes before the
> > agent.get. I will appreciate any help.
>
> Make sure to do it before the get.
>
> Hope that helps!
>
> --
> Aaron Patterson
> http://tenderlovemaking.com/
> _______________________________________________
> 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/20070712/2823715a/attachment-0001.html