Why can't save to the database? TypeError: string indices must be integers

I can’t recreate the problem with the data you’ve posted. This leads me to believe there’s something being lost in how this is being printed. (I’ve got the funny feeling that what you’re actually getting from response.json is a list of strings - just a hunch, no direct evidence of this yet.)
Try adding print(type(patients)) after the print(patients) line and print(type(patient)) as the first statement in the for loop.
It might also be worthwhile to print(response.text) after the request.

Finally, to avoid having the forum software distort what you’re posting as printed output, please enclose your print output between the three backtick characters too. (I see you’re already doing that with the code.) I’m guessing it’s the forum software that converted the single quotes to the fancy quotes.

1 Like