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

return response instead of raw for stream requests #245

Merged
merged 1 commit into from
Jan 4, 2024

Conversation

rupurt
Copy link
Contributor

@rupurt rupurt commented Dec 22, 2023

What It Does

How to Test

  • Download dataset via stream
response = zosmf_files.get_dsn_content_streamed(dsn)
with open(destination_path, "wb") as fd:
    for chunk in response.iter_content(chunk_size=256):
        fd.write(chunk)
        size += len(chunk)

Review Checklist
I certify that I have:

@rupurt rupurt force-pushed the return-response-from-stream-request branch from b17d91d to 2062d34 Compare December 22, 2023 18:49
@rupurt rupurt force-pushed the return-response-from-stream-request branch from 2062d34 to a1770cb Compare December 22, 2023 18:50
@rupurt rupurt marked this pull request as ready for review December 22, 2023 18:50
@JTonda JTonda requested a review from t1m0thyj January 3, 2024 16:13
Copy link

codecov bot commented Jan 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (8c9580a) 83.79% compared to head (a1770cb) 83.79%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #245   +/-   ##
=======================================
  Coverage   83.79%   83.79%           
=======================================
  Files          34       34           
  Lines        2117     2117           
=======================================
  Hits         1774     1774           
  Misses        343      343           
Flag Coverage Δ
unittests 83.79% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@t1m0thyj t1m0thyj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rupurt Thanks for your contribution!

Although this is a breaking change for anyone using SDK methods that return streams, it seems to follow the best practices recommended by the requests package 👍

@rupurt
Copy link
Contributor Author

rupurt commented Jan 3, 2024

@t1m0thyj yeah, that would be unfortunate. But I feel like this is something worth making a breaking change for. Currently you need to manually decode the gzipped responses. If we want to avoid a breaking change, how do you feel about an extra argument raw = True ?

Copy link
Member

@zFernand0 zFernand0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with the position of just making the breaking change.
We do want to handle as much as it makes sense, and also follow recommended practices.

LGTM! 😋

P.S. I don't think we need an extra parameter 😋

@t1m0thyj t1m0thyj merged commit 6678663 into zowe:main Jan 4, 2024
23 checks passed
@rupurt rupurt deleted the return-response-from-stream-request branch January 4, 2024 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants