How to set content type for POST requests in python request library?

One API that I am currently using indicates that I need a special content type string. I don't know how to install this in python request library

+15
source share
2 answers
import requests

headers = {'Content-type': 'content_type_value'}
r = requests.get(url, headers=headers)
+34
source

Vikas Oyha answered correctly.

I created a class for access and validation, which you can get here.

This is only possible thanks to Mozilla. I hope they update the list.

A partial list of all available content types is here (from Mozilla)

0
source

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


All Articles