Project

General

Profile

Bug #56882

opendatasoft: les réponses 404 ne contiennent pas de JSON

Added by sentry io 17 days ago. Updated 13 days ago.

Status:
Solution déployée
Priority:
Normal
Assignee:
Target version:
-
Start date:
11 Sep 2021
Due date:
% Done:

0%

Estimated time:
Patch proposed:
Yes
Planning:
No

Description

https://sentry.entrouvert.org/entrouvert/publik/issues/51693/

JSONDecodeError: Expecting value: line 2 column 1 (char 1)
(3 additional frame(s) were not displayed)
...
  File "passerelle/apps/opendatasoft/models.py", line 88, in call_search
    err_desc = result_response.json().get('error')
  File "requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None

Error occurred while processing request

Files

Associated revisions

Revision 74895168 (diff)
Added by Nicolas Roche 13 days ago

opendatasoft: manage HTTP errors (#56882)

History

#1

Updated by Benjamin Dauvergne 17 days ago

  • Project changed from Suivi des traces to Passerelle
#2

Updated by Nicolas Roche 15 days ago

  • Assignee set to Nicolas Roche
#3

Updated by Nicolas Roche 14 days ago

Le code et un peu différent que d'habitude parce que l'api d'opendatasoft prévoit un message d'erreur mais ne précise rien sur le statut HTTP.
https://help.opendatasoft.com/apis/ods-search-v1/#errors-handling

When an error occurs, a JSON object describing the error is returned by the API.

Dans les faits on se retrouve avec des 4XX qui renseignent ce message et d'autres non :
$ curl -v https://examples.opendatasoft.com/api/records/1.0/search/

< HTTP/2 400
{"error": "Parameter 'dataset' is mandatory."}

curl -v https://examples.opendatasoft.com/api/records/1.0/search/bof/
< HTTP/2 404
...pas du json...

#4

Updated by Benjamin Dauvergne 14 days ago

  • Status changed from Solution proposée to Solution validée
#5

Updated by Nicolas Roche 13 days ago

  • Status changed from Solution validée to Résolu (à déployer)
commit 74895168a8123b994d24825c44dee5909aabf06b
Author: Nicolas ROCHE <nroche@entrouvert.com>
Date:   Mon Sep 13 18:04:18 2021 +0200

    opendatasoft: manage HTTP errors (#56882)
#6

Updated by Frédéric Péters 13 days ago

  • Status changed from Résolu (à déployer) to Solution déployée

Also available in: Atom PDF