python script aborts on Ubuntu 16.04: No JSON object could be decoded
M. Fioretti
mfioretti at nexaima.net
Tue Aug 28 09:19:23 UTC 2018
Hello Oliver, and thanks for your continued support!
the python-request module is installed. I forgot to check if it was
installed, and the script would just abort and complain.
the apikey provided by the shaarli installation is passed to the script
about the "Must include the /api/v1" part:
I too had noticed that. That subfolder is not present in the current
version of shaarli. When I realized that, I started passing to the
script the URL that, from my own understanding of the PHP source code
should be the one to use now. But indeed, I cannot be sure that it is
so.
Thanks,
Marco
On 2018-08-28 10:09, Oliver Grawert wrote:
> 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
--
http://mfioretti.com
More information about the ubuntu-users
mailing list