Azure / autorest.python

Extension for AutoRest (https://github.com/Azure/autorest) that generates Python code
MIT License
77 stars 55 forks source link

Add support for configuring decompression on streaming download APIs #2618

Closed jalauzon-msft closed 1 week ago

jalauzon-msft commented 1 month ago

Currently Storage generated code response.stream_download in all download APIs (Example). Azure Core's StreamDownloadGenerator (which stream_download returns) takes a decompress keyword arg to configure whether the response is automatically decompressed during download for relevant content encodings.

We would like to be able to expose this option to our users but the generated code does not have a way to pass anything to the stream_download method. It would be great if there was a way to pass at least decompress into this call from our hand-written code.

msyyc commented 1 month ago

After https://github.com/Azure/autorest.python/pull/2605, we switch to rest responses. For backward compatiblility, rest responses still has stream_download.

lmazuel commented 2 weeks ago

@msyyc I think you misunderstood the ask. Stream_download is called from inside the codegen, so customer don't control the kwarg that can be injected when it's called. Jacob would like a way to do it.

msyyc commented 2 weeks ago

@msyyc I think you misunderstood the ask. Stream_download is called from inside the codegen, so customer don't control the kwarg that can be injected when it's called. Jacob would like a way to do it.

I quite get what you mean and https://github.com/Azure/autorest.python/issues/2618#issuecomment-2159934311 is just hint for me that it is doable even if we covert to rest responses after https://github.com/Azure/autorest.python/pull/2605. Now I am still waiting for @johanste opinion in teams channel and appreciate if you could help ping him. @lmazuel

msyyc commented 2 weeks ago

image After discussion, SDK team is OK to expose new kwargs decompress and I will begin the coding soon.