[Cubicweb] Apache authentication: which CubicWeb API?

Dimitri Papadopoulos Orfanos dimitri.papadopoulos at cea.fr
Wed Oct 9 11:10:13 CEST 2013

Thank you Sylvain. I feel the documentation would benefit from a "client 
programming" chapter. It would be a matter of a few paragraphs. Right 
now the documentation lacks information on how to access the CubicWeb 
database programatically and not only from an off-the-shelf Web browser 
(which I think is the exaclt purpose of semantic Web as opposed to Web).

I can see two transport layers that can be used to access CubicWeb and 
need to be documented:
0. Command "cubicweb-ctl shell" is already documented and besides it is 
for administrative tasks only - not client programming per se.
1. ZMQ is associated to "Repository development".
2. HTTP is associated to "Web side development".

The main issues that would need to be documented for each transport 
layer are:
* session management (cookies for HTTP),
* formats available by default (csv, json, xml, etc.) - and how to find 
the list of additional formats?
* how to ask for a specific format ("&vid=..." in HTTP)

Le 09/10/2013 09:33, Sylvain Thénault a écrit :
> On 08 octobre 22:38, Nicolas Chauvat wrote:
>> 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
> You need cookie handling if you want a session, so almost always when you start
> doing more than a single HTTP request. Extract from
> cubicweb.server.sources.datafeed:
>    _OPENER = urllib2.build_opener()
>    # this is for Kerberos authentication support
>    try:
>        from logilab.common import urllib2ext
>        _OPENER.add_handler(urllib2ext.HTTPGssapiAuthHandler())
>    except ImportError: # python-kerberos not available
>        pass
>    # and this for cookies
>    _OPENER.add_handler(urllib2.HTTPCookieProcessor(CookieJar()))
> Then you can use _OPENER.open(url), authenticating the first time using __login
> and __password and next request will have the session cookie set.

Dimitri Papadopoulos
I2BM, NeuroSpin
F-91191 Gif-sur-Yvette cedex, France

More information about the Cubicweb mailing list