philyoon / google-api-python-client

Automatically exported from code.google.com/p/google-api-python-client
Other
0 stars 0 forks source link

Can't insert multiple permissions with BatchHttpRequest #260

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When I add some permissions on a document via BatchHttpRequest, only one of 
these permissions is effectively added to the document. The others are ignored.

Below is some sample code:

    def callback(request_id, response, exception):
        if exception is not None:
            logger.debug(exception)
        else:
            logger.debug(response)

    batch = BatchHttpRequest(callback)  # from apiclient.http
    batch.add(drive_client.permissions().insert(body=permission_1))
    batch.add(drive_client.permissions().insert(body=permission_2))
    ...
    batch.add(drive_client.permissions().insert(body=permission_n))
    batch.execute()

Only permissions of type "user" are added. The default entry ("anyone") is 
ignored. Response is always logged, so everything seems to run fine.

If I execute each call separately, all the permissions are added.

Original issue reported on code.google.com by peter.da...@sheepdog.com on 17 Apr 2013 at 2:55

GoogleCodeExporter commented 8 years ago
This seems to be a bug with the Drive API rather than the library. I will try 
to forward along to one of them.

Original comment by dhermes@google.com on 17 Apr 2013 at 3:15

GoogleCodeExporter commented 8 years ago
From https://developers.google.com/drive/v2/reference/permissions/insert :

> Warning: Concurrent permissions operations on the same file are not 
supported; only the last update is applied.

Original comment by hom...@gmail.com on 27 Mar 2014 at 2:23