[Cubicweb] [PROVENANCE INTERNET] Re: Apache authentication: which CubicWeb API?

Nicolas Chauvat nicolas.chauvat at logilab.fr
Tue Oct 8 22:38:27 CEST 2013


Hi Dimitri,

On Tue, Oct 08, 2013 at 09:41:43PM +0200, Dimitri Papadopoulos Orfanos wrote:
> How to programatically access the URL from a client program, not a
> Web browser?

pydoc urllib2 ?

> Are cookies needed?

Only if your site requires cookies to log in and the information you
are looking for is not available to anonymous users.

http://docs.python.org/2/library/cookielib.html

> Anything else I should be aware of?

Depends what you are trying to do... please be more specific :)

> What about error detection and specifically HTTP return codes
> (parsing HTML or any other format does not look like a good
> solution)?

f = urllib2.urlopen(MYURL)
f.getcode()

If there are cases like the one you cited earlier where the site says
"authentication failure" and returns code 200, it is a bug of CubicWeb
and it will be fixed.

-- 
Nicolas Chauvat

logilab.fr - services en informatique scientifique et gestion de connaissances  



More information about the Cubicweb mailing list