I'm a tad baffled as to why this bit of code has suddenly decided to fail when it had been working fine for a week.
import firebase_admin
from firebase_admin import firestore, credentials,db, auth
def userIsLoggedIn(self,id_token: str) -> bool:
try:
decoded_token = auth.verify_id_token(id_token)
self.uid = decoded_token['uid']
except Exception as e:
return False,str(e)
return True,""
The error message returned is: 'HTTPResponse' object has no attribute 'strict' And I can only replicate this error when I am testing on my cloud server as opposed to localhost.
I have reviewed the stack trace and I see it is the auth.verify_id_token
function causing issues, and specifically then:
ile "/usr/local/lib/python3.11/site-packages/cachecontrol/serialize.py", line 54, in dumps
2023-05-04T16:11:04.767062340Z u"strict": response.strict,
2023-05-04T16:11:04.767067540Z ^^^^^^^^^^^^^^^
2023-05-04T16:11:04.767072540Z AttributeError: 'HTTPResponse' object has no attribute 'strict'
EDIT:
Ok so Patrick below pointed me to a link that tells me:
"this appears to be an incompatibility in cachecontrol with the new release of urllib3 2.0. strict is no longer a supported argument on the HTTPResponse class. For the time being you'll likely need to pin to an older version of urllib3 or work with the cachecontrol team to update their usage."
I'll have to see if I can do anything about this for now. For example using urllib3 2.0.0 as a workaround as suggested by Patrick.