Forums

JSONDecodeError

Hi

Error -

  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 812, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/simplejson/__init__.py", line 516, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python2.7/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/local/lib/python2.7/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I have intercepted the script on my machine to see what kind of json is sent in post data.

This -

json=%7b%22from_name%22%3a%22%22%2c%22contact_type%22%3a%22%22%2c%22contact_value%22%3a%22%22%2c%22message%22%3a%22Message%22%2c%22to_name%22%3a%22%22%7d

so its url encoded after "json="

Please can you help me out in how to resolve this situation.

Regards

Could you post the code you're currently using to get the data?

Hi

Codes from this github project -

https://github.com/dPhoeniixx/Textnow-API

Thank you

Ah, OK. I think the problem is happening because you have a free account, and free accounts can only access external sites on our whitelist. The request is returning a "403 forbidden" message, which has an explanation of the whitelist, but the API code you're using is trying to interpret that as JSON, which is of course failing.

If you can find an official page on the Textnow website that documents the API -- that GitHub repo is not an official one -- and give us a link, we can add their API to the whitelist and it should work fine. Alternatively, if you want unrestricted Internet access, you can upgrade to a paid account.