Skip to content

Commit 93fda89

Browse files
committed
add get response body as stream content
1 parent f85ba50 commit 93fda89

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/msgraph_core/requests/batch_response_content.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ def get_response_by_id(
5858
return response_type.create_from_discriminator_value(self._responses.get(request_id))
5959
return self._responses.get(request_id)
6060

61+
def get_response_stream_by_id(self, request_id: str) -> Optional[BytesIO]:
62+
"""
63+
Get a response by its request ID and return the body as a stream
64+
:param request_id: The request ID of the response to get
65+
:type request_id: str
66+
:return: The response Body as a stream
67+
:rtype: io.BytesIO
68+
"""
69+
response_item = self.get_response_by_id(request_id)
70+
if response_item is None or response_item.body is None:
71+
return None
72+
73+
return BytesIO(response_item.body)
74+
6175
def response(
6276
self,
6377
request_id: str,

0 commit comments

Comments
 (0)