microsoftgraph / msgraph-sdk-python

MIT License
372 stars 54 forks source link

Batch Requests #78

Closed jignesh-crest closed 1 month ago

jignesh-crest commented 1 year ago

Great work on the package!!

Does the package support batching the get calls?

samwelkanda commented 1 year ago

Hey @jignesh-crest. Thank you for the feedback!

As of now, batch requests are not supported. However we do have the work item lined up in our backlog. I'm not able to provide a concrete timeline on when it'll be added but I'll provide an update once it's available.

Thanks.

dmartin-r7 commented 1 year ago

@samwelkanda does this sdk have exponential back off or rate limit handling for throttled calls?

Nikki1993 commented 8 months ago

Now that v1.0 is out, is there support for batch calls for various APIs? I wanted to try SDK in our own project and we employ heavy use of $batch endpoint but I am not seeing obvious ways to create such requests and Microsoft Graph Documentation is missing code samples for Python SDK despite seeing 1.0 release.

WardenHub commented 5 months ago

Now that v1.0 is out, is there support for batch calls for various APIs? I wanted to try SDK in our own project and we employ heavy use of $batch endpoint but I am not seeing obvious ways to create such requests and Microsoft Graph Documentation is missing code samples for Python SDK despite seeing 1.0 release.

It's not implemented yet.. I'm handling the 429 errors as follows .. it gets slow though

 async def make_teams_activity_request(formatted_date):
    try:
        res = await graph_client.reports.get_teams_user_activity_user_detail_with_date(formatted_date).get()
        return res
    except APIError as e:
        if e.response_status_code == 429:
            print(f"{'-'*15}{e.response_status_code}{'-'*15}\nWaiting {config['request_delay']}seconds because of:\n\n{e}{'-'*30}")
            # Introduce a delay between requests
            await asyncio.sleep(config.get('request_delay', 0))
            # Retry the request and return its result
            return await make_teams_activity_request(formatted_date)
        else:
            print(f"{'-'*15}Error {e.response_status_code}{'-'*15}\n{e}\n{'-'*30}")
marsch commented 1 month ago

+1 for me - somehow its useless for updating sharepoint list items without the $batch-endpoint

andrueastman commented 1 month ago

Thanks for the input here, everyone. For consistency, we'll track this work/request via https://github.com/microsoftgraph/msgraph-sdk-python-core/issues/474 and close this one for now.

Please follow up there for more updates as we work towards getting this done.