def _authenticate(self, email, password): loaded_auth = FileHelper.load_file('auth') if loaded_auth is not None: token = jwt.decode(loaded_auth["access_token"], algorithms="HS512", options={"verify_signature": False}) if email == token["sub"] and token["exp"] > time.time(): print("Using saved access-token") return loaded_auth else: print("Saved token is invalid or expired", token) content = { 'email': email, 'password': password } auth = requests.post( BringAPI.BASE_URL + 'bringauth', content).json() FileHelper.save_file("auth", auth) return auth