python script aborts on Ubuntu 16.04: No JSON object could be decoded
Oliver Grawert
ogra at ubuntu.com
Tue Aug 28 08:09:17 UTC 2018
hi,
Am Dienstag, den 28.08.2018, 06:47 +0200 schrieb M. Fioretti:
>
>
> right before the one that prints the error message below, it prints:
>
> <Response [200]>
>
> IIUC, this means that shaarli answers with an HTTP response code
> *instead* of something in JSON format, as expected, and is this that
> causes the error:
>
> "JSONDecodeError: Expecting value..."
>
> by simple_json. Am I right? If yes, what now?
>
looking at the code:
response = requests.post(args.url+"/links",
data=json.dumps(new_bookmark), headers=headers)
do you have the python-requests library installed ?
in general, when using such a third party python script you should
first take a look at all the import statements at the top of the code.
then find out which deb package provides which of the imported modules
(apt-cache search and google are usually helpful with that) and install
them ...
another issue i see is that the script needs to send an api key, did
you provide one in your invocation ?
also ... quoting from the code:
argparser.add_argument("--url", action="store", required=True,
help="Full URL to a Shaarli instance. Must include the /api/v1
bit.")
but your url does not seem to include /api/v1 anywhere ...
ciao
oli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20180828/bb5e6e72/attachment.sig>
More information about the ubuntu-users
mailing list