Skip to content

Conversation

@shemogumbe
Copy link
Contributor

@shemogumbe shemogumbe commented Oct 8, 2024

Closes #700

batch_request_item1 = BatchRequestItem(request_information=request_info1)
batch_request_item2 = BatchRequestItem(request_information=request_info2)
batch_request_item3 = BatchRequestItem(
    request_information=request_info3, depends_on=[batch_request_item2]
)

brcc = BatchRequestContentCollection()
brcc.add_batch_request_item(batch_request_item1)
brcc.add_batch_request_item(batch_request_item2)
brcc.add_batch_request_item(batch_request_item3)


async def get_batch_response():
    batch_response = await batch_request_builder.post(batch_request_content=brcc)
    for response_content in batch_response.get_responses():
        for request_id, response in response_content.responses.items():
            print(f"Batch response content collection {response.status}")
            print(f"Batch response content collection {response.body}")

Result

Batch response content collection b"{'@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#users', 'value': [{'businessPhones': ['+1 425 555 0109'], 'displayName': 'Adele Vance', 'givenName': 'Adele', 'jobTitle': 'Retail Manager', 'mail': 'AdeleV@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '18/2111', 'preferredLanguage': 'en-US', 'surname': 'Vance', 'userPrincipalName': 'AdeleV@yygbp.onmicrosoft.com', 'id': '6d57388a-534a-4347-a264-b1fa0c3d95f3'}, {'businessPhones': ['+1 858 555 0110'], 'displayName': 'Alex Wilber', 'givenName': 'Alex', 'jobTitle': 'Marketing Assistant', 'mail': 'AlexW@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '131/1104', 'preferredLanguage': 'en-US', 'surname': 'Wilber', 'userPrincipalName': 'AlexW@yygbp.onmicrosoft.com', 'id': '4c7c823e-9480-4bda-8a56-ee7bcb590653'}, {'businessPhones': ['+1 205 555 0108'], 'displayName': 'Diego Siciliani', 'givenName': 'Diego', 'jobTitle': 'HR Manager', 'mail': 'DiegoS@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '14/1108', 'preferredLanguage': 'en-US', 'surname': 'Siciliani', 'userPrincipalName': 'DiegoS@yygbp.onmicrosoft.com', 'id': '1c196809-2483-46e7-8f6f-0989a1dbe972'}, {'businessPhones': ['+1 309 555 0104'], 'displayName': 'Grady Archie', 'givenName': 'Grady', 'jobTitle': 'Designer', 'mail': 'GradyA@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '19/2109', 'preferredLanguage': 'en-US', 'surname': 'Archie', 'userPrincipalName': 'GradyA@yygbp.onmicrosoft.com', 'id': 'c046d74d-857a-445e-bec6-bd504fefd012'}, {'businessPhones': ['+1 954 555 0118'], 'displayName': 'Henrietta Mueller', 'givenName': 'Henrietta', 'jobTitle': 'Developer', 'mail': 'HenriettaM@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '18/1106', 'preferredLanguage': 'en-US', 'surname': 'Mueller', 'userPrincipalName': 'HenriettaM@yygbp.onmicrosoft.com', 'id': 'f7d237ff-b77a-4899-8d01-7de4e8aec38c'}, {'businessPhones': ['+1 918 555 0101'], 'displayName': 'Isaiah Langer', 'givenName': 'Isaiah', 'jobTitle': 'Sales Rep', 'mail': 'IsaiahL@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '20/1101', 'preferredLanguage': 'en-US', 'surname': 'Langer', 'userPrincipalName': 'IsaiahL@yygbp.onmicrosoft.com', 'id': '5bd51fd7-2952-4628-b779-df00eaf84dfe'}, {'businessPhones': ['+1 502 555 0102'], 'displayName': 'Johanna Lorenz', 'givenName': 'Johanna', 'jobTitle': 'Senior Engineer', 'mail': 'JohannaL@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '23/2102', 'preferredLanguage': 'en-US', 'surname': 'Lorenz', 'userPrincipalName': 'JohannaL@yygbp.onmicrosoft.com', 'id': 'e713fef7-85c1-46bf-b558-3a16d821fdcd'}, {'businessPhones': ['+1 980 555 0101'], 'displayName': 'Joni Sherman', 'givenName': 'Joni', 'jobTitle': 'Paralegal', 'mail': 'JoniS@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '20/1109', 'preferredLanguage': 'en-US', 'surname': 'Sherman', 'userPrincipalName': 'JoniS@yygbp.onmicrosoft.com', 'id': '81114af6-4ec3-47b2-9bf8-656be6f05789'}, {'businessPhones': ['+1 913 555 0101'], 'displayName': 'Lee Gu', 'givenName': 'Lee', 'jobTitle': 'Director', 'mail': 'LeeG@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '23/3101', 'preferredLanguage': 'en-US', 'surname': 'Gu', 'userPrincipalName': 'LeeG@yygbp.onmicrosoft.com', 'id': '465728a0-91b3-439b-8d93-20b000c89433'}, {'businessPhones': ['+1 918 555 0107'], 'displayName': 'Lidia Holloway', 'givenName': 'Lidia', 'jobTitle': 'Product Manager', 'mail': 'LidiaH@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '20/2107', 'preferredLanguage': 'en-US', 'surname': 'Holloway', 'userPrincipalName': 'LidiaH@yygbp.onmicrosoft.com', 'id': '45f92007-04bb-43c2-8729-53aa6c5cc786'}, {'businessPhones': ['+1 918 555 0104'], 'displayName': 'Lynne Robbins', 'givenName': 'Lynne', 'jobTitle': 'Planner', 'mail': 'LynneR@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '20/1104', 'preferredLanguage': 'en-US', 'surname': 'Robbins', 'userPrincipalName': 'LynneR@yygbp.onmicrosoft.com', 'id': '7da423cf-c5fe-48df-9340-7497172df0ef'}, {'businessPhones': ['+1 412 555 0109'], 'displayName': 'Megan Bowen', 'givenName': 'Megan', 'jobTitle': 'Marketing Manager', 'mail': 'MeganB@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '12/1110', 'preferredLanguage': 'en-US', 'surname': 'Bowen', 'userPrincipalName': 'MeganB@yygbp.onmicrosoft.com', 'id': 'd88e413e-2e36-4515-bddf-48d5c4b60f0d'}, {'businessPhones': ['+1 858 555 0109'], 'displayName': 'Miriam Graham', 'givenName': 'Miriam', 'jobTitle': 'Director', 'mail': 'MiriamG@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '131/2103', 'preferredLanguage': 'en-US', 'surname': 'Graham', 'userPrincipalName': 'MiriamG@yygbp.onmicrosoft.com', 'id': '03c8c919-8662-4bfa-b690-2472af79de42'}, {'businessPhones': ['+1 206 555 0105'], 'displayName': 'Nestor Wilke', 'givenName': 'Nestor', 'jobTitle': 'Director', 'mail': 'NestorW@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '36/2121', 'preferredLanguage': 'en-US', 'surname': 'Wilke', 'userPrincipalName': 'NestorW@yygbp.onmicrosoft.com', 'id': 'd5fcbdb1-4378-4e5a-b66a-8d6b750bf06e'}, {'businessPhones': ['+1 502 555 0144'], 'displayName': 'Patti Fernandez', 'givenName': 'Patti', 'jobTitle': 'President', 'mail': 'PattiF@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '15/1102', 'preferredLanguage': 'en-US', 'surname': 'Fernandez', 'userPrincipalName': 'PattiF@yygbp.onmicrosoft.com', 'id': '441ea33c-8d50-417f-b5c1-75c2fe9605fe'}, {'businessPhones': ['+20 255501070'], 'displayName': 'Pradeep Gupta', 'givenName': 'Pradeep', 'jobTitle': 'Accountant', 'mail': 'PradeepG@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': '98/2202', 'preferredLanguage': 'en-US', 'surname': 'Gupta', 'userPrincipalName': 'PradeepG@yygbp.onmicrosoft.com', 'id': '5c14e3c4-d817-471e-bf8c-05784172de03'}, {'businessPhones': ['254727138748'], 'displayName': 'Shem Ogumbe', 'givenName': 'Shem', 'jobTitle': None, 'mail': 'SHEMTEE@yygbp.onmicrosoft.com', 'mobilePhone': None, 'officeLocation': None, 'preferredLanguage': 'en', 'surname': 'Ogumbe', 'userPrincipalName': 'SHEMTEE@yygbp.onmicrosoft.com', 'id': '76b4a63a-8dee-428d-b39d-404d14a7ee96'}]}"

@shemogumbe shemogumbe marked this pull request as ready for review October 9, 2024 11:09
@shemogumbe shemogumbe requested a review from a team as a code owner October 9, 2024 11:09
@shemogumbe shemogumbe requested a review from baywet October 14, 2024 14:56
@shemogumbe shemogumbe force-pushed the shem/fix_add_depends_on_bug branch 3 times, most recently from 982c1ce to 5711d4f Compare October 22, 2024 14:07
Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

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

Thank you for making the changes!
I think we're getting closer to a final version, a couple of comments.

@sonarqubecloud
Copy link

Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

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

Thank you for making the changes!

Copy link
Contributor

@andrueastman andrueastman left a comment

Choose a reason for hiding this comment

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

👍🏼

@musale musale merged commit 9d4153a into main Nov 21, 2024
13 checks passed
@musale musale deleted the shem/fix_add_depends_on_bug branch November 21, 2024 10:30
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.

Creating dependent batch requests results in AttributeError: 'str' object has no attribute 'id'

5 participants