tags:

views:

43

answers:

1

I'm trying to build a python library for interacting with our RESTful API, but it uses CAS for client auth, and I haven't been able to find any good existing libraries for it. So far I've found the following links, but I'm not sure if they're intended to be used in clients or by a website that uses CAS itself. Does anyone have any advice for a good library to use and a good way to structure my code for interacting with it?

https://wiki.jasig.org/download/attachments/28213515/pycas.py.txt

https://sp.princeton.edu/oit/sdp/CAS/Wiki%20Pages/Python.aspx

http://github.com/benoitc/restkit/

http://morethanseven.net/2009/02/18/python-rest-client.html

I also just tried using caslib, but that fails to work:

>>> import caslib
>>> srv = caslib.CASServer('https://my.cas/auth')
>>> svc = caslib.CASService('https://my.service/foo')
>>> caslib.login_to_cas_service(srv.login(svc),'[email protected]','password')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "caslib/cas_dance.py", line 250, in login_to_cas_service
    raise CASLoginError('Could not parse the document at %s: %s' % (login_fh.url, errors))
caslib.cas_dance.CASLoginError: Could not parse the document at https://my.cas/auth/login?service=https%3A%2F%2Fmy.service%2Ffoo: undefined entity &copy;: line 97, column 26

Hmm, the error above appears to be in our markup (or the validater that caslib uses.)

Edit again: The failure is removed after installing the lxml library for python. The fallback parser didn't work as well.

+1  A: 

You might have to roll you own solution, either by modifying the python rest client to support CAS, or building something from scratch (I would recommend on top of httplib2.)

mikerobi
Hopefully it won't come to that, but thanks. I'll keep looking into it.
Daenyth