Trying to post json to the specified URL using requests:
import requests, glob, unicodedata, ntpath, time, json
url = 'https://myWebsite.com/ext/ext/ext'
json_file = open("/Users/ME/Documents/folder/folder/test.json")
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
r = requests.post(url, data=json.dumps(json_file), headers=headers)
This gives me the following error, however:
TypeError: <open file '/Users/ME/Documents/folder/folder/test.json', mode 'r' at 0x1021c9660> is not JSON serializable
What causes this error? I know my json file is valid json so I don't think that is the problem.