Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use upstream implementation of RESTStream.prepare_request once it becomes avaiable #10

Open
edgarrmondragon opened this issue Nov 13, 2024 · 0 comments
Labels
enhancement New feature or request Singer SDK Requires upstream Singer SDK changes

Comments

@edgarrmondragon
Copy link
Member

def prepare_request(
self,
context: Context | None,
next_page_token: str | None,
) -> requests.PreparedRequest:
"""Prepare a request object for this stream.
If partitioning is supported, the `context` object will contain the partition
definitions. Pagination information can be parsed from `next_page_token` if
`next_page_token` is not None.
Args:
context: Stream partition or context dictionary.
next_page_token: Token, page number or any request argument to request the
next page of data.
Returns:
Build a request with the stream's URL, path, query parameters,
HTTP headers and authenticator.
"""
http_method = self.rest_method
url: str = self.get_url(context)
params: dict | str = self.get_url_params(context, next_page_token)
request_data = self.prepare_request_payload(context, next_page_token)
headers = self.http_headers
return self.build_prepared_request(
method=http_method,
url=url,
params=params,
headers=headers,
# Note: Had to override this method to switch this to data instead of json
data=request_data,
)

Related:

@edgarrmondragon edgarrmondragon added enhancement New feature or request Singer SDK Requires upstream Singer SDK changes labels Nov 13, 2024
@edgarrmondragon edgarrmondragon changed the title Use upstream implementation of RESTSteram.prepare_request once it becomes avaiable Use upstream implementation of RESTStream.prepare_request once it becomes avaiable Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Singer SDK Requires upstream Singer SDK changes
Projects
None yet
Development

No branches or pull requests

1 participant