[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

WWW::Mechanize and basic_auth

Todd A. Jacobs

3/15/2008 9:05:00 PM

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....)

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"

12 Answers

saronpasu

3/16/2008 3:27:00 AM

0

[Note: parts of this message were removed to make it a legal post.]

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.... <http://192.168.20....)


2008/3/16, Todd A. Jacobs <tjacobs-sndr-019fdb@codegnome.org>:
>
> 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....)
>
> 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"
>
>
>

Todd A. Jacobs

3/16/2008 3:11:00 PM

0

On Sun, Mar 16, 2008 at 12:27:21PM +0900, saronpasu wrote:

> "WWW::Mechanize#auth" is not basic authentication method. Please try
> again by using "WWW::Mechanize#basic_auth" for basic authentication.

I get exactly the same result with this method as well.

--
"Oh, look: rocks!"
-- Doctor Who, "Destiny of the Daleks"

Jeffrey 'jf' Lim

3/16/2008 5:23:00 PM

0

[Note: parts of this message were removed to make it a legal post.]

On Sun, Mar 16, 2008 at 11:10 PM, Todd A. Jacobs <
tjacobs-sndr-019fdb@codegnome.org> wrote:

> On Sun, Mar 16, 2008 at 12:27:21PM +0900, saronpasu wrote:
>
> > "WWW::Mechanize#auth" is not basic authentication method. Please try
> > again by using "WWW::Mechanize#basic_auth" for basic authentication.
>
> I get exactly the same result with this method as well.
>

it's username first, then password. Have u gotten the order mixed up?

-jf

--
In the meantime, here is your PSA:
"It's so hard to write a graphics driver that open-sourcing it would not
help."
-- Andrew Fear, Software Product Manager, NVIDIA Corporation
http://kerneltrap.org...

Todd A. Jacobs

3/17/2008 12:12:00 AM

0

On Mon, Mar 17, 2008 at 02:23:00AM +0900, Jeffrey 'jf' Lim wrote:

> it's username first, then password. Have u gotten the order mixed up?

Nope.

--
"Oh, look: rocks!"
-- Doctor Who, "Destiny of the Daleks"

Todd A. Jacobs

3/17/2008 5:56:00 PM

0

On Sun, Mar 16, 2008 at 06:05:04AM +0900, Todd A. Jacobs wrote:

> 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....)

It occurs to me that there is no documented interface for selecting a
realm. Is this automagical, or am I supposed to set the realm somehow?
If so, how do I do that, and where is it documented?

--
"Oh, look: rocks!"
-- Doctor Who, "Destiny of the Daleks"

Aaron Patterson

3/17/2008 9:40:00 PM

0

On Tue, Mar 18, 2008 at 02:56:06AM +0900, Todd A. Jacobs wrote:
> On Sun, Mar 16, 2008 at 06:05:04AM +0900, Todd A. Jacobs wrote:
>
> > 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....)
>
> It occurs to me that there is no documented interface for selecting a
> realm. Is this automagical, or am I supposed to set the realm somehow?
> If so, how do I do that, and where is it documented?

For basic authentication, mechanize just delegates to net/http. Can you
add a logger to mechanize and send me your logs?

agent.log = Logger.new(STDOUT)

Is this against Apache? If so, could you send your config, and I'll try
to reproduce the error.

--
Aaron Patterson
http://tenderlovem...

Jeffrey 'jf' Lim

3/19/2008 3:59:00 AM

0

[Note: parts of this message were removed to make it a legal post.]

On Tue, Mar 18, 2008 at 1:56 AM, Todd A. Jacobs <
tjacobs-sndr-019fdb@codegnome.org> wrote:

> On Sun, Mar 16, 2008 at 06:05:04AM +0900, Todd A. Jacobs wrote:
>
> > 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....)
>
> It occurs to me that there is no documented interface for selecting a
> realm. Is this automagical, or am I supposed to set the realm somehow?
> If so, how do I do that, and where is it documented?
>

the realm is presented by the server. This has nothing to do with the client
in that sense.

-jf

--
In the meantime, here is your PSA:
"It's so hard to write a graphics driver that open-sourcing it would not
help."
-- Andrew Fear, Software Product Manager, NVIDIA Corporation
http://kerneltrap.org...

Skokiaan

6/28/2010 4:45:00 PM

0

On Jun 26, 3:35 pm, Billy Shears <the_truth_nothing_...@yahoo.com>
wrote:
> On Jun 26, 1:07 pm, iarwain <iarwai...@hotmail.com> wrote:
>
>
>
>
>
> > >$50.00 to Lennon (estate) and McCartney as the song writers
>
> > That's interesting, thanks for posting this.  I wasn't aware that the
> > songwriters still got money once the publishing rights had been given
> > away (or sold).  I was under the impression Sony/ATV and Michael
> > Jackson had been getting all the money all these years, except for
> > whatever the Beatles got for record sales.
>
> > In regard to 1965, would Brian Epstein gotten another 25% of Lennon
> > and McCartney's 50% because of his management contract?  Or would that
> > not have applied to their songwriting?
>
> > --
>
> > All follow-ups are directed to the newsgroup rec.music.beatles.moderated.    
> > If your follow-up more properly belongs in the unmoderated newsgroup, please
> > change your headers appropriately.   -- the moderators
> > --
>
> I'm hoping that someone could verify that what I wrote originally is
> correct.  But I think that Brian Epstein also would have collected 25%
> of the total Beatles share.
>

The book "Northern Songs: The True Story of the Beatles Song
Publishing Empire" will answer all your questions - if you can get
through it. This book goes into (too much) detail of the Beatles'
publishing. It's a slow, boring read filled with names of every
lawyer, stockholder and janitor that was ever involved with their
publishing or thought about buying it for five minutes.

Here's a link:
http://www.amazon.com/Northern-Songs-Beatles-Publishing-Empire/dp/184609996X/ref=sr_1_1?ie=UTF8&s=books&qid=1277735839&...

--

All follow-ups are directed to the newsgroup rec.music.beatles.moderated.
If your follow-up more properly belongs in the unmoderated newsgroup, please
change your headers appropriately. -- the moderators
--

Billy Shears

6/29/2010 4:05:00 AM

0

Thanks "rags"! I used to correspond with this group and the moderated
version years ago and I remember you from then. If Brian didn't
double dip then John and Paul had a pretty good deal considering most
other song writers were lucky to come away with their 50% song writers
royalties from the publishers. Plus John and Paul would get a piece
of any other song writer that used Northern Songs for publishing
(early George Harrison songs for one).

But if Brian (as we both suspect) double dipped then the Lads got
screwed.

On Jun 28, 3:19 pm, rags <rags_mail_@_fast_mail_._fm_._invalid> wrote:
> Skokiaan <skoki...@aol.com> wrote innews:c33b2e4d-5e08-4e3a-9eac-a97d3bf96dea@g19g2000yqc.googlegroups.com:
>
> > The book "Northern Songs: The True Story of the Beatles Song
> > Publishing Empire" will answer all your questions - if you can get
> > through it.  This book goes into (too much) detail of the Beatles'
> > publishing.  It's a slow, boring read filled with names of every
> > lawyer, stockholder and janitor that was ever involved with their
> > publishing or thought about buying it for five minutes.
>
> > Here's a link:
> >http://www.amazon.com/Northern-Songs-Beatles-Publishing-Empir...
> > 9996X/ref=sr_1_1?ie=UTF8&s=books&qid=1277735839&sr=1-1
>
> A dissenting opinion: if you ("generic 'you'", not anyone in particular)
> like detail, and really want to know what this story is all about, you
> won't find the book at all boring.  Just a matter of taste, and of what
> you're looking for.  
>
> If brevity (and an incomplete story) is what you're after, try
>  http://wiki.answers.com/Q/Who_owns_the_Beatles&...
>
> However, I'm not sure any of this really answers the original question:
> did Brian get his % from two sources: his own stake in Northern Songs,
> plus his commission on all Beatles' earnings.  (I suspect he did, but
> cannot be authoratative about it.)
>
> --
> -= rags =-
> <www.math.mcgill.ca/rags>
> rags _at_ math _dot_ mcgill _dot_ ca
>
> --
>
> All follow-ups are directed to the newsgroup rec.music.beatles.moderated.    
> If your follow-up more properly belongs in the unmoderated newsgroup, please
> change your headers appropriately.   -- the moderators

--

All follow-ups are directed to the newsgroup rec.music.beatles.moderated.
If your follow-up more properly belongs in the unmoderated newsgroup, please
change your headers appropriately. -- the moderators
--

Skokiaan

6/29/2010 4:53:00 PM

0

On Jun 29, 12:05 am, Billy Shears <the_truth_nothing_...@yahoo.com>
wrote:
> Thanks "rags"!  I used to correspond with this group and the moderated
> version years ago and I remember you from then.  If Brian didn't
> double dip then John and Paul had a pretty good deal considering most
> other song writers were lucky to come away with their 50% song writers
> royalties from the publishers.  Plus John and Paul would get a piece
> of any other song writer that used Northern Songs for publishing
> (early George Harrison songs for one).
>
> But if Brian (as we both suspect) double dipped then the Lads got
> screwed.
>
> On Jun 28, 3:19 pm, rags <rags_mail_@_fast_mail_._fm_._invalid> wrote:
>
>
>
>
>
> > Skokiaan <skoki...@aol.com> wrote innews:c33b2e4d-5e08-4e3a-9eac-a97d3bf96dea@g19g2000yqc.googlegroups.com:
>
> > > The book "Northern Songs: The True Story of the Beatles Song
> > > Publishing Empire" will answer all your questions - if you can get
> > > through it.  This book goes into (too much) detail of the Beatles'
> > > publishing.  It's a slow, boring read filled with names of every
> > > lawyer, stockholder and janitor that was ever involved with their
> > > publishing or thought about buying it for five minutes.
>
> > > Here's a link:
> > >http://www.amazon.com/Northern-Songs-Beatles-Publishing-Empir...
> > > 9996X/ref=sr_1_1?ie=UTF8&s=books&qid=1277735839&sr=1-1
>
> > A dissenting opinion: if you ("generic 'you'", not anyone in particular)
> > like detail, and really want to know what this story is all about, you
> > won't find the book at all boring.  Just a matter of taste, and of what
> > you're looking for.  
>
> > If brevity (and an incomplete story) is what you're after, try
> >  http://wiki.answers.com/Q/Who_owns_the_Beatles&...
>
> > However, I'm not sure any of this really answers the original question:
> > did Brian get his % from two sources: his own stake in Northern Songs,
> > plus his commission on all Beatles' earnings.  (I suspect he did, but
> > cannot be authoratative about it.)
>

Going by memory here. Corrections are most welcome.

Brian didn't get a piece of the songwriting but did own a piece of the
publishing (Northern Songs). Dick James owned 50% of Northern Songs
while the other 50% was split between John, Paul, Brian (via NEMS),
George and Ringo. That meant Dick James had a controlling interest
right from the start. When Brian died his brother sold Brian's share
to Dick James instead of John and Paul, causing friction in that
relationship. Allen Klein, in an effort to bring in fast cash for his
clients, advised John and Paul to sell their shares of Northern Songs
to Dick James, believing as most did at the time that after the band
ceases to exist that their catalog wouldn't be worth much. Hard to
believe today.

Dick James sold his publishing company, which included Northern Songs,
to ATV. Michael Jackson then bought ATV. Because Dick James always
held a controlling interest, even if John and Paul hadn't sold off
their share of their publishing their songs would still be used in
commercials today, but John and Paul would have made a ton more money.

--

All follow-ups are directed to the newsgroup rec.music.beatles.moderated.
If your follow-up more properly belongs in the unmoderated newsgroup, please
change your headers appropriately. -- the moderators
--