I'm attempting to create an export request for all my users in my organization with Google Vault API in python
I have tried slowing my API requests with time.sleep(x). I have tried modifying the script to do one account at a time, with manual running of said script.
if not result:
        print('No matters found.')
    else:
        #error checking for user list
        if not emails:
            print("missing users list")
        else:
            for user in emails:
                req = {
                        "name":user,
                        "query":{
                            "corpus":'DRIVE',
                            "dataScope":'ALL_DATA',
                            "searchMethod":'ACCOUNT',
                            "accountInfo":{
                                "emails":[user]
                                }
                            }
                        }
            #create drive export request
                userReq = vaultservice.matters().exports().create(matterId=matters[0]['matterId'],body=req).execute()
                print ("completed request: {0}".format(user))
                time.sleep(10)
When I did an export of the entire org, it creates a gigantic zip file that's not useful because I don't know what belongs to who. So I then attempted to create individual export requests.
With current script, I see this error "Quota exceeded for quota metric 'vault.googleapis.com/export_writes' and limit 'ExportWritesPerMinutePerProject' of service 'vault.googleapis.com'"
Sometimes I get one export successfully done, sometimes two, but then it errors out. What is the rate limit for Google Vault, or how else should I accomplish my task?
Update I just got up and running on the API dashboard, and found out that the default quota limit for export writes is 20 per minute. However, I don't understand then why I am running into a limit problem. Even with a modified sleep(60) before the export create, it peaks at 20 requests and limits me. I guess I don't understand why my script is creating so many requests in a second, when I believe it should only create one.