I am trying to construct a dictionary with a list of IDs, which will be used as the response from an API. The dict will be used to generate a JSON response.
I am trying to append a list of IDs that have been affected by the request, but am experiencing an error shown below the code.
I have the following code:
data = {"data" : { "message" : "UPDATED TICKETS SUCCESSFULLY", "status" : 200}}
data['data'].append({"child_ids" : child_sr_ids})
The error that I am getting is: AttributeError: 'dict' object has no attribute 'append'
This seems to contradict other sources that I have read such as this: Appending to list in Python dictionary
I am sure I'm doing something simple wrong but I can't work it out. Would appreciate some direction.
edit: title has been changed to better reflect the correct terminology