Skip to content

Commit

Permalink
fix: mypy type error on refresh_token
Browse files Browse the repository at this point in the history
  • Loading branch information
waza-ari committed Aug 20, 2024
1 parent 9d8cfbc commit d2c26fc
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions easyverein/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""

import logging
from typing import Callable
from typing import Callable, cast

from .core.client import EasyvereinClient
from .core.responses import BearerToken
Expand Down Expand Up @@ -83,4 +83,9 @@ def refresh_token(self) -> BearerToken:
raise ValueError("Refresh token is only available for API v2.0")

response = self.c.fetch_one(self.c.get_url("/refresh-token"))
return parse_models(response.result, BearerToken)
token = parse_models(response.result, BearerToken)
if not token:
self.logger.error(f"Error refreshing token: {response.result}")
raise ValueError(f"Error refreshing token: {response.result}")

return cast(BearerToken, token)

0 comments on commit d2c26fc

Please sign in to comment.