'How to change media type to "csv" or "excel" instead of "json" file in fastapi

I am working on github api using fastapi, Trying to pull the all userlist through fastapi. But i am able to get the data as a json format. But how can i change the media type (Download csv instead of json) from json to csv.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source