Skip to content

Commit

Permalink
check for response type of returned value by engine.handle_url
Browse files Browse the repository at this point in the history
  • Loading branch information
thilak reddy committed Oct 4, 2023
1 parent 953547f commit 2c63a27
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/opal-client/opal_client/data/fetcher.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
from typing import Any, Dict, List, Optional, Tuple

import aiohttp
from fastapi import HTTPException
from opal_client.config import opal_client_config
from opal_client.policy_store.base_policy_store_client import JsonableValue
Expand Down Expand Up @@ -85,7 +86,10 @@ async def handle_url_with_retry():
try:
# ask the engine to get our data
response = await self._engine.handle_url(url, config=config)
if response.status >= 400:
if (
isinstance(response, aiohttp.ClientResponse)
and response.status >= 400
):
logger.error(
"error while fetching url: {url}, got response code: {code}",
url=url,
Expand Down

0 comments on commit 2c63a27

Please sign in to comment.