digital-science / dimcli

Python client and CLI for scientometrics and research analytics using the Dimensions API.
https://digital-science.github.io/dimcli/getting-started.html
MIT License
43 stars 6 forks source link

JSON decode error when searching cltrials #1

Closed lambdamusic closed 5 years ago

lambdamusic commented 5 years ago

On instance test

> search clinical_trials for "cancer" return clinical_trials[id + title + date] limit 100
You said: search clinical_trials for "cancer" return clinical_trials[id + title + date] limit 100
Traceback (most recent call last):
  File "/Users/michele.pasin/Envs/dimcli2/bin/dimcli", line 11, in <module>
    load_entry_point('dimcli', 'console_scripts', 'dimcli')()
  File "/Users/michele.pasin/Envs/dimcli2/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/Users/michele.pasin/Envs/dimcli2/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/Users/michele.pasin/Envs/dimcli2/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/michele.pasin/Envs/dimcli2/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/Users/michele.pasin/Envs/dimcli2/lib/python3.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/michele.pasin/Dropbox/code/python/dimcli/dimcli_project/dimcli/main_cli.py", line 74, in main_cli
    repl.run(instance_name)
  File "/Users/michele.pasin/Dropbox/code/python/dimcli/dimcli_project/dimcli/console/repl.py", line 239, in run
    handle_query(CLIENT, text, databuffer)
  File "/Users/michele.pasin/Dropbox/code/python/dimcli/dimcli_project/dimcli/console/repl.py", line 164, in handle_query
    res = CLIENT.query(text)
  File "/Users/michele.pasin/Dropbox/code/python/dimcli/dimcli_project/dimcli/dimensions.py", line 99, in query
    result = resp.json()
  File "/Users/michele.pasin/Envs/dimcli2/lib/python3.7/site-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
lambdamusic commented 5 years ago

Fixed in 0.3.8: DImensions API errors are always caught so that ideally the REPL never breaks

> search clinical_trials for "cancer" return clinical_trials[id + title + date] limit 100
You said: search clinical_trials for "cancer" return clinical_trials[id + title + date] limit 100
502 Server Error: Bad Gateway for url: https://app.dimensions.ai/api/dsl.json