What type of mime should return for python string

I have a web API that returns python dictionaries or lists as an answer, which I use eval () in python scripts that use the API, for completeness I wanted to set the correct content type, but not sure if it would be better to use " text / x-python "or maybe" application / python "or something else?

[edit] I also output JSON, I make Python as an option, mainly for internal use. [/ edit]

+3
source share
2 answers

The authoritarian registry in IANA and no, there is no standard subtype for Python. Thus, do not use the type "application / python", but you can use private subtypes such as "text / x-python" (the one I found in the mime support package on my Debian).

+3
source

I doubt that there is an established MIME type. Do you think that you are using JSON, it is almost the same as the Python dict, and has a better culture of tools and techniques.

+8
source

Source: https://habr.com/ru/post/1699224/


All Articles