Skip to content

Commit

Permalink
add raise_for_status as httpx doesn't have this configuration in clie…
Browse files Browse the repository at this point in the history
…nt level
  • Loading branch information
omer9564 committed May 30, 2024
1 parent c898bda commit a0b217f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/opal-common/opal_common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class OpalCommonConfig(Confi):
"HTTP_FETCHER_PROVIDER_CLIENT",
"aiohttp",
description="The client to use for fetching data, can be either aiohttp or httpx."
"if provided different value, aiohttp will be used.",
"if provided different value, aiohttp will be used.",
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

import httpx
from aiohttp import ClientResponse, ClientSession
from pydantic import validator
from opal_common.config import opal_common_config
from pydantic import validator

from ...http import is_http_error_response
from ...security.sslcontext import get_custom_ssl_context
Expand Down Expand Up @@ -89,11 +89,12 @@ async def _fetch_(self):
self._session, self._event.config.method
)
if self._event.config.data is not None:
result = await http_method(
result: Union[ClientResponse, httpx.Response] = await http_method(
self._url, data=self._event.config.data, **self._ssl_context_kwargs
)
else:
result = await http_method(self._url, **self._ssl_context_kwargs)
result.raise_for_status()
return result

@staticmethod
Expand Down

0 comments on commit a0b217f

Please sign in to comment.