diff --git a/ee/billing/billing_manager.py b/ee/billing/billing_manager.py index f564ffb160a03..93eebe19a6d6c 100644 --- a/ee/billing/billing_manager.py +++ b/ee/billing/billing_manager.py @@ -1,3 +1,4 @@ +import json from datetime import datetime, timedelta from typing import Any, Optional, cast @@ -5,7 +6,6 @@ import requests import structlog from django.utils import timezone -from requests.exceptions import JSONDecodeError from rest_framework.exceptions import NotAuthenticated from sentry_sdk import capture_exception @@ -48,7 +48,7 @@ def handle_billing_service_error(res: requests.Response, valid_codes=(200, 404, try: response = res.json() raise Exception(f"Billing service returned bad status code: {res.status_code}", f"body:", response) - except JSONDecodeError: + except json.decoder.JSONDecodeError: raise Exception(f"Billing service returned bad status code: {res.status_code}", f"body:", res.text)