Skip to content

token=False not respected for a request in a session with token auth configured

As of igwn-auth-utils 1.0.1 the following works when it shouldn't:

from igwn_auth_utils import Session
# configure a Session, defaulting to token auth
with Session(token=True, token_scope="gwdatafind.read") as sess:
    # manually disable token auth for this request
    print(sess.get("https://datafind.ligo.org/LDR/api/version", cert=False, token=False))

The way that requests combines auth from the Session and the request means that a value of None from the request is being replaced with the not None value from the Session. We probably need to force that to False in this case.