<#3483 feat(taps): New `RESTStream.get_http_reques...
# meltano-repo-activity
g
#3483 feat(taps): New `RESTStream.get_http_request` method to construct the HTTP request for a stream Pull request opened by edgarrmondragon Related • #1606 • MeltanoLabs/tap-dbt#135 • PoC: reservoir-data/tap-bitly#494 Summary by Sourcery Introduce a dedicated HTTPRequest abstraction in the REST stream layer and update tap-dummyjson to use it for request construction and parameter handling. New Features: • Add an HTTPRequest dataclass for REST streams, including customizable query parameter encoding and reusable request construction via RESTStream.get_http_request. Enhancements: • Refactor RESTStream.prepare_request to build requests from HTTPRequest instances and standardize URL parameter typing and encoding. • Simplify DummyJSONAuthenticator to always set the Authorization header after ensuring a valid token. • Update tap-dummyjson client pagination to override get_http_request instead of get_url_params for setting paging parameters. Tests: • Add a unit test covering custom HTTPRequest.encode_params behavior with safe characters in query parameters. Summary by Sourcery Introduce an HTTPRequest abstraction and context for RESTStream to construct and customize HTTP requests, and migrate pagination and client patterns to use it instead of get_url_params while deprecating prepare_request overrides. New Features: • Add an HTTPRequest dataclass and HTTPRequestContext for representing REST stream HTTP requests and their pagination/context. • Expose RESTStream.get_http_request for building per-request URL, headers, params, and payload from stream context and paginator state. Enhancements: • Refactor RESTStream request preparation to build PreparedRequest objects from HTTPRequest instances with standardized payload typing and parameter encoding. • Update built-in taps (dummyjson, GitLab) and the cookiecutter tap template to implement pagination by overriding get_http_request instead of get_url_params. • Improve paginator typing for RESTStream and BaseAPIPaginator implementations. • Emit deprecation warnings when prepare_request is overridden, including when the override is in an intermediate base class. • Adjust documentation examples to show customizing pagination by modifying HTTPRequest rather than URL parameter dicts. Documentation: • Add reference stubs for HTTPRequest and HTTPRequestContext and update pagination and incremental replication guides to document get_http_request-based pagination patterns. Tests: • Add unit tests for HTTPRequest parameter encoding, including custom safe characters and non-string parameter values. • Extend REST pagination and metrics tests to cover the new get_http_request usage and deprecation warnings for prepare_request overrides. meltano/sdk