How to add multiple attachments to a cell using Pygrister and the Grist API

I am trying to add multiple attachments to a specific cell, which I am able to do manually.

The attachments have been uploaded and have ids 5 and 7.

The first row in my table has an id of 1.

The Python code I’m executing is:

from pygrister.api import GristApi
config = ...
table_id = ...
rec_updates = ...
grist = GristApi(config=config)
grist.update_records(table_id=table_id, records=rec_updates)

Executing each of the following works as expected, by adding the requested attachment to the cell:

rec_updates = {'id': 1, 'photos': ['L', 7]}
rec_updates = {'id': 1, 'photos': ['L', 5]}

However, I can not crack the syntax to upload multiple attachments to that cell, I’ve tried each of the following:

rec_updates = {'id': 1, 'photos': ['L', [5, 7]]}
rec_updates = {'id': 1, 'photos': [['L', 5], ['L', 7]]}

These both fail with a HTTPError: 400 Client Error: Bad Request for url: … error.

Also, executing rec_updates = {'id': 1, 'photos': ['L', 7]} followed by rec_updates = {'id': 1, 'photos': ['L', 5]}, overrides the first attachment with the second.

Any thoughts on how to achieve this?

I came across this post by Dmitry_Sagalovskiy, which solved my problem.

The correct syntax is:

rec_updates = {'id': 1, 'photos': ['L', 5, 7]}

Thank you Dmitry.