I’m trying to use Python to create a note from an email received. Creating the note works with:
curl_command = 'curl --data \'{ "title": "' + sUB + '", "body": "' + Final_body + '", "parent_id": "' + joplin_inbox_folder + '" }\' http://localhost:41184/notes?token=' + joplin_token
os.system(curl_command)
if Final_body just contains a simple piece of text that I’ve inserted into it. But if I use a real email the note isn’t created and log_clipper.txt shows:
2019-06-07 16:31:39: "Request: POST /notes?token=[my joplin token]"
2019-06-07 16:31:39: "SyntaxError: Unexpected token
in JSON at position 75
SyntaxError: Unexpected token
in JSON at position 75
at JSON.parse (<anonymous>)
at Api.action_notes (/tmp/.mount_JoplinAvIN0i/resources/app/lib/services/rest/Api.js:362:29)
at Api.route (/tmp/.mount_JoplinAvIN0i/resources/app/lib/services/rest/Api.js:120:42)
at execRequest (/tmp/.mount_JoplinAvIN0i/resources/app/lib/ClipperServer.js:147:39)
at IncomingMessage.request.on (/tmp/.mount_JoplinAvIN0i/resources/app/lib/ClipperServer.js:190:8)
at IncomingMessage.emit (events.js:182:13)
at endReadableNT (_stream_readable.js:1092:12)
at process._tickCallback (internal/process/next_tick.js:63:19)"
Sometimes the Python program also says Unexpected token \n in JSON at position 75
I’m not a Python programmer and know very little about Ubuntu, where I’m running this, but if anyone has the time to point me in the right direction I’d appreciate it.