Issue
That code will break:
auth = PortalSSOAuth("alice", "secure secret", digest_algorithm="MD5") req = Request("GET", "https://httpbin.org/get", auth=auth) prepared = req.prepare()
It will throw that error:
AttributeError: 'NoneType' object has no attribute 'update'
Analysis
When crafting the Portal SSO token, we check if the given digest algorithm is available in the hashlib module. But we do not take care of uppercased algorithms or even unknown ones.