Extract download streaming logic into DownloadableMixin#1803
Open
jacalata wants to merge 3 commits into
Open
Conversation
After the download logic was extracted into DownloadableMixin._download_content, the module-level io_types_w tuples in datasources, flows, and workbooks endpoints became dead code. Also removes the duplicate io_types_r / io_types_w definitions in flows_endpoint and the unreferenced io_types alias in datasources_endpoint. All 843 tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The mixin was imported in __init__.py but omitted from __all__, making the export implicit. Add it explicitly so the public surface matches the import statement. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DownloadableMixininendpoint.pywith a single private helper_download_content(url, filepath)that streams a server response to a file path or writable file objectWorkbooks,Datasources, andFlows, replacing three identical 15-line streaming blocks with a single shared implementationio_types_wand duplicateio_typesmodule-level variables from all three endpoint filesDownloadableMixinfrom the endpoint package__all__Schema compliance
Download endpoints return raw binary bodies outside the XML schema scope. All response handling (Content-Disposition header parsing, chunked streaming, octet-stream bodies) is implemented at the HTTP layer identically to the pre-refactor code. No schema-level gaps found.
Test plan
server.workbooks.download(id, filepath=tmp_path)writes a file and returns an absolute pathserver.workbooks.download(id, filepath=io.BytesIO())writes to the buffer and returns the buffer objectserver.datasources.downloadandserver.flows.downloadbehave identicallyfrom tableauserverclient.server.endpoint import DownloadableMixinis importable🤖 Generated with Claude Code