Skip to content

Commit

Permalink
fix: fixed typechecking issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Oct 25, 2023
1 parent c80cc36 commit 5d06b08
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions aw_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import requests as req
from aw_core.dirs import get_data_dir
from aw_core.models import Event
from aw_transform.heartbeats import heartbeat_merge

from .config import load_config
from .singleinstance import SingleInstance
Expand All @@ -31,10 +32,9 @@


def _log_request_exception(e: req.RequestException):
r = e.response
logger.warning(str(e))
try:
d = r.json()
d = e.response.json() if e.response else None
logger.warning(f"Error message received: {d}")
except json.JSONDecodeError:
pass
Expand Down Expand Up @@ -152,7 +152,7 @@ def get_event(
event = self._get(endpoint).json()
return Event(**event)
except req.exceptions.HTTPError as e:
if e.response.status_code == 404:
if e.response and e.response.status_code == 404:
return None
else:
raise
Expand Down Expand Up @@ -230,8 +230,6 @@ def heartbeat(
the function will in that case always returns None.
"""

from aw_transform.heartbeats import heartbeat_merge

endpoint = f"buckets/{bucket_id}/heartbeat?pulsetime={pulsetime}"
_commit_interval = commit_interval or self.commit_interval

Expand Down

0 comments on commit 5d06b08

Please sign in to comment.