Skip to content

Commit b871815

Browse files
committed
fix post batch collection
1 parent 3015f19 commit b871815

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

src/msgraph_core/requests/batch_request_builder.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ async def post_content(
107107
else:
108108
raise ValueError("Invalid type for batch_request_content.")
109109

110-
print(f"request info to be posted {request_info}")
111-
112110
# Decode and re-encode the content to ensure it is in the correct format
113111
content = json.loads(request_info.content.decode("utf-8"))
114112
json_body = json.dumps(content)
@@ -153,12 +151,10 @@ async def post_batch_collection(
153151

154152
for batch_request_content in batch_request_content_collection.batches:
155153
request_info = await self.to_post_request_information(batch_request_content)
156-
print(f"request_info content before call {request_info.content}")
157-
# response = await self._request_adapter.send_async(
158-
# request_info, BatchResponseContent, error_map
159-
# )
160-
# = await self.post_content(batch_request_content, error_map)
161-
# batch_responses.add_response(batch_request_content.requests.keys(), response)
154+
response = await self._request_adapter.send_async(
155+
request_info, BatchResponseContent, error_map
156+
)
157+
batch_responses.add_response(response)
162158

163159
return batch_responses
164160

@@ -215,12 +211,10 @@ async def to_post_request_information_from_collection(
215211

216212
all_requests = []
217213
for batch_content in batch_request_content.batches:
218-
print(f"batch_content {batch_content}")
219214
requests_dict = [item.get_field_deserializers() for item in batch_content.requests]
220215
all_requests.extend(requests_dict)
221216

222217
request_info.content = json.dumps({"requests": all_requests}).encode("utf-8")
223-
print(f"All requests {request_info.content}")
224218

225219
request_info.headers = HeadersCollection()
226220
request_info.headers.try_add("Content-Type", APPLICATION_JSON)

src/msgraph_core/requests/batch_response_content_collection.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Optional, Dict, Callable
1+
from typing import Optional, Dict, Callable, List
22

33
from kiota_abstractions.serialization import Parsable
44
from kiota_abstractions.serialization import ParseNode
@@ -20,16 +20,16 @@ def __init__(self) -> None:
2020
body: Optional[StreamInterface] = None
2121
2222
"""
23-
self._responses = []
23+
self._responses: List[BatchResponseContent] = []
2424

25-
def add_response(self, keys, response) -> None:
25+
def add_response(self, response: BatchResponseContent) -> None:
2626
"""
2727
Adds a response to the collection.
2828
Args:
2929
keys: The keys of the response to add.
3030
response: The response to add.
3131
"""
32-
self._responses.append((keys, response))
32+
self._responses.append(response)
3333

3434
def get_responses(self):
3535
"""

0 commit comments

Comments
 (0)