Skip to content

Commit

Permalink
chore: rename session warn func and add docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
z3z1ma committed May 23, 2024
1 parent 6923202 commit bc184e2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dlt/sources/helpers/rest_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def __init__(
self.auth = auth

if session:
self.session = _warn_session_raise_for_status(session)
# dlt.sources.helpers.requests.session.Session
# has raise_for_status=True by default
self.session = _warn_if_raise_for_status_and_return(session)
else:
self.session = Client(raise_for_status=False).session

Expand Down Expand Up @@ -288,7 +290,8 @@ def detect_paginator(self, response: Response, data: Any) -> BasePaginator:
return paginator


def _warn_session_raise_for_status(session: BaseSession) -> BaseSession:
def _warn_if_raise_for_status_and_return(session: BaseSession) -> BaseSession:
"""A generic function to warn if the session has raise_for_status enabled."""
if getattr(session, "raise_for_status", False):
logger.warning(
"The session provided has raise_for_status enabled. This may cause unexpected behavior."
Expand Down

0 comments on commit bc184e2

Please sign in to comment.