我有以下代码:
import requests
import json
import urllib2
content = "<div style=\"font-family: 'Comic Sans MS'; font-size: 12pt;\">this is to test <span id=\"var_acronym\" style=\"color:rgb(236, 27, 82)\" var=\"acronym\">[acronym]</span></div>\n\n<div style=\"font-family: 'Comic Sans MS'; font-size: 12pt;\"><img alt=\"\" height=\"121\" src=\"http://witimages.acrowit.com/020bd157-ec10-4a3c-961d-3efb9b962539\" width=\"206\" /></div>\n\n<div style=\"font-family: 'Comic Sans MS'; font-size: 12pt;\"><a href=\"http://www.wittyparrot.com\">http://www.wittyparrot.com</a></div>\n"
wit = '{ "name": "hello","parentId": "'+FolderId+'", "content": "'+str(content)+'","witType": "ORDINARY", "desc": "This is testing of Authorization wit","note": "Hello auto wit"}'
response = requests.post(URLcreate, data=wit , headers={"Content-Type":"application/json","Authorization":tiketId} )
create = json.loads(response.content)
print create
当我运行上面的代码时,它给出了以下错误:
File "F:\SharingWitinNewArch.py", line 62, in <module>
create = json.loads(response.content)
File "C:\Python27\lib\json\__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "C:\Python27\lib\json\decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python27\lib\json\decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
[Finished in 7.3s with exit code 1]