Hello,

My script to call a web service authenticates.  I would like to be
able to trap an exception if the authentication fails.  The script
loops over a list of dates and I don't want it to retry for every
element in the list.  This could take a long time and be very annoying
when, after the long wait, a stacktrace spews out of the last attempt.
The assumption is that if it fails, it is not a transient network or
some other issue but that the credentials themselves are faulty.

Now, the authentication header is sent with the initial request, so it
does not look to me like the standard process of request, get a 401
and then re-request with credentials is relevant.  However, clearly
the opener issues a number of retries after the initial failure.

But, I don't see a mechanism in urllib2 for taking notice of a failure
and acting on it.

Can somebody point me toward a solution?

Thanks.

mp

-- 
Michael Powe            mich...@trollope.org            Naugatuck CT USA

"And I'd be a Libertarian, if they weren't all a bunch of tax-dodging
professional whiners." -- Berke Breathed

Attachment: pgptBq2mUrmnN.pgp
Description: PGP signature

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to