arthurdejong / python-stdnum

A Python library to provide functions to handle, parse and validate standard numbers.
https://arthurdejong.org/python-stdnum/
GNU Lesser General Public License v2.1
503 stars 211 forks source link

[stdnum.do] check_dgii on rnc is giving JSONDecodeError #64

Closed gustavovalverde closed 6 years ago

gustavovalverde commented 6 years ago
Traceback (most recent call last):
  File "C:\Users\gvalv\rnc-cedula.py", line 3, in <module>
    rnc.check_dgii('131566332')
  File "C:\Users\gvalv\AppData\Local\Programs\Python\Python36-32\lib\site-packages\stdnum\do\rnc.py", line 149, in check_dgii
    return _convert_result(result)
  File "C:\Users\gvalv\AppData\Local\Programs\Python\Python36-32\lib\site-packages\stdnum\do\rnc.py", line 115, in _convert_result
    for key, value in json.loads(result.replace('\t', '\\t')).items())
  File "C:\Users\gvalv\AppData\Local\Programs\Python\Python36-32\lib\json\__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "C:\Users\gvalv\AppData\Local\Programs\Python\Python36-32\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\gvalv\AppData\Local\Programs\Python\Python36-32\lib\json\decoder.py", line 355, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)
arthurdejong commented 6 years ago

This problem is specific to PySimpleSOAP and should not occur when using suds or zeep. There is something funny going on with the DGII SOAP service because the services return a string with JSON-encoded data and PySimpleSOAP for some reason returns a dict instead of a string.