That request is getting a website; not a json object. The Authorization Code Flow is more complex than your code.
Also, the header should be: headers = {"Content-Type": "application/x-www-form-urlencoded"}.
Because it returns html code, and not json, .json() causes an error.
Just replace the header, remove .json(), try print out the response with print(code.text), and see it for yourself.
That request is getting a website; not a json object. The Authorization Code Flow is more complex than your code.
Also, the header should be: headers = {"Content-Type": "application/x-www-form-urlencoded"}.
Because it returns html code, and not json, .json() causes an error.
Just replace the header, remove .json(), try print out the response with print(code.text), and see it for yourself.