Forum Discussion

GD-L's avatar
GD-L
Frequent Visitor
2 years ago
Solved

Some endpoints 429 faster than others?

I've read through and found no indication to what the real rate limiting is on GET requests. However, when using the admin endpoint for 

Admin - Datasets GetDatasetToDataflowsLinksInGroupAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Learn I get a 429 error significantly faster than say Admin - Datasets GetDatasetsAsAdmin - REST API (Power BI Power BI REST APIs) | Microsoft Learn is there any reason why one endpoint would trigger faster than another?

Using Python via pbipy.

Code as below:

group = 0
while group < len(groups):
    id = groups.loc[group,"id"]
    if id not in processed_groups:  # Only process the group if it hasn't been processed yet
        try:
            upstream = admin.datasets_upstream_dataflows(group = id)
            for data in upstream:
                unpacked_data = [value for key, value in data.items()]
                upstream_data.append((id, *unpacked_data))
            processed_groups.add(id)  # Add the group to the set of processed groups
            group += 1
            time.sleep(2)
        except Exception as e:
            if '429' in str(e):
                print("429 error, sleeping for 10 minutes")
                time.sleep(600)
            else:
                upstream_data.append((id, str(e)))
                processed_groups.add(id)  # Add the group to the set of processed groups
                group += 1
    else:
        group += 1  # If the group has already been processed, move on to the next one

1 Reply