Skip to content

Commit

Permalink
refactor: define response outside try-except
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian2012 committed Oct 15, 2024
1 parent a119e81 commit 6ebab7c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion event_routing_backends/utils/xapi_lrs_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ def bulk_send(self, statement_data):
requests.Response object
"""
logger.debug('Sending {} xAPI statements to {}'.format(len(statement_data), self.URL))
response = None

try:
response = self.lrs_client.save_statements(statement_data)
except JSONDecodeError as e:
except JSONDecodeError:
logger.warning(f"Events already in LRS: {response.request.content}")

Check warning on line 80 in event_routing_backends/utils/xapi_lrs_client.py

View check run for this annotation

Codecov / codecov/patch

event_routing_backends/utils/xapi_lrs_client.py#L80

Added line #L80 was not covered by tests

if not response:
return

Check warning on line 83 in event_routing_backends/utils/xapi_lrs_client.py

View check run for this annotation

Codecov / codecov/patch

event_routing_backends/utils/xapi_lrs_client.py#L83

Added line #L83 was not covered by tests

if not response.success:
Expand Down

0 comments on commit 6ebab7c

Please sign in to comment.