Skip to content

Commit

Permalink
feat(taps): Tap developers can now disable HTTP redirects (#2433)
Browse files Browse the repository at this point in the history
feat(taps): Tap developers can now disable redirects
  • Loading branch information
edgarrmondragon authored May 17, 2024
1 parent 22b2065 commit e0c5dfd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion singer_sdk/streams/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ class RESTStream(Stream, t.Generic[_TToken], metaclass=abc.ABCMeta): # noqa: PL
#: Example: `"$.next_page"`
next_page_token_jsonpath: str | None = None

#: Optional flag to disable HTTP redirects. Defaults to False.
allow_redirects: bool = True

# Private constants. May not be supported in future releases:
_LOG_REQUEST_METRICS: bool = True
# Disabled by default for safety:
Expand Down Expand Up @@ -257,7 +260,11 @@ def _request(
Returns:
TODO
"""
response = self.requests_session.send(prepared_request, timeout=self.timeout)
response = self.requests_session.send(
prepared_request,
timeout=self.timeout,
allow_redirects=self.allow_redirects,
)
self._write_request_duration_log(
endpoint=self.path,
response=response,
Expand Down

0 comments on commit e0c5dfd

Please sign in to comment.