Forums

Working script not working in PythonAnywhere?

Hi, I have working script but when I tryed to run it here it gives me an error, I will appreciate any help:

Traceback (most recent call last):
  File "nhk-today.py", line 108, in <module>
    main()
  File "nhk-today.py", line 14, in main
    o = json.loads(r.text)
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Could you add:

print(r.text)

just before the json.loads?

It says:

Access to arbitrary websites is not available from free accounts;
you can only access sites that are on our
<a href="http://www.pythonanywhere.com/whitelist">whitelist</a>.
If you want to suggest something to add to our whitelist
drop us a line at support@pythonanywhere.com.  It will have
to have an official public API.

The site I want to download text is for japanese news - http://www3.nhk.or.jp/news/easy/index.html

If you are seeing this error, it is because external internet access for free users are restricted to a whitelist.

You can either upgrade, or if you need to access a public api, we are happy to add it to the whitelist if you provide us with the api's documentation.