amishas157 / wikidata-label-upload

Upload different language translations to wikidata
1 stars 0 forks source link

Script crashes if no API response #4

Closed planemad closed 8 years ago

planemad commented 8 years ago

If the API response fails for some reason, the script crashes

Traceback (most recent call last):
  File "script.py", line 42, in <module>
    r4 = json.loads(r4.text)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
planemad commented 8 years ago

Done by pywikibot