Python RESTful client with CAS authentication

2024-05-23 18:17:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图构建一个python库来与restfulapi进行交互,但是它使用CAS进行客户机身份验证,而且我还没有找到任何合适的现有库。到目前为止,我已经找到了以下链接,但我不确定这些链接是用于客户端还是用于使用CAS本身的网站。有没有人对一个好的库有什么建议可以使用,以及如何构造我的代码与之交互的好方法?在

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

我也尝试过使用caslib,但没有成功:

>>> import caslib
>>> srv = caslib.CASServer('https://my.cas/auth')
>>> svc = caslib.CASService('https://my.service/foo')
>>> caslib.login_to_cas_service(srv.login(svc),'user@example.com','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

嗯,上面的错误似乎出现在我们的标记(或caslib使用的验证程序)中

再次编辑:在安装了用于python的lxml库之后,故障被删除。后备解析器不能正常工作。在


Tags: pyhttpscomauthhttp链接myservice