Improve kerberos handling when creating a Session
This PR works around some issues for users who don't specify the endpoint when making a request, and don't have ECP_IDP
set (which is the default for 'new' users). There are two things included here
- attempt to use a kerberos principal name to infer the IdP
- improve the error handling when the IdP is not given or discoverable
This (when combined with #84) should mean that the following results are given for LIGO users who don't have ECP_IDP
configured:
-
no kerberos credential
>>> from ciecplib import get >>> print(get('https://ldas-jobs.ligo.caltech.edu/~duncan.macleod/hello.html').text) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/duncan/git/ciecplib/ciecplib/requests.py", line 36, in _wrapper kwargs['session'] = Session( File "/home/duncan/git/ciecplib/ciecplib/sessions.py", line 55, in __init__ raise ValueError( ValueError: no Identity Provider (IdP) given, and no kerberos credential discovered, unable to dynamically determine IdP endpoint
-
active LIGO.ORG-real kerberos credential
>>> from ciecplib import get >>> print(get('https://ldas-jobs.ligo.caltech.edu/~duncan.macleod/hello.html').text) HELLO
cc @SeanDS