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

Fix depends on Bug #702

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Fix depends on Bug #702

wants to merge 3 commits into from

Conversation

shemogumbe
Copy link
Collaborator

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

sonarcloud bot commented Oct 22, 2024

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'
3 participants