Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
To pass tests, I have added time.sleep(0.1) in my function to avoid the error.
With 3 attempts, 2 are ok. Maybe time.sleep(0.2) would be better.
i have deployed a quick-fix that should allow the kata to be solveable again in Python, though it is probably not a long-term solution. I have reduced the number of random tests and added some delay in-between requests.
I have narrowed down the cause of the bug. It seems that Wikidata lowered their allowed request rate. The test suite makes too many requests with too short a delay between them. As a result, wikidata responds with the error code 429 (Too Many Requests). As there is then no JSON response to parse when that occurs, the error cascade shown above is triggered. By deleting some of the fixed tests and calling
time.sleep()
with a reasonable delay between random tests, the error no longer occurs.yup same
such a good problem but unsolveable
It gives this weird error on the second random test. Don't ask me why.
Traceback (most recent call last):
File "/workspace/default/.venv/lib/python3.11/site-packages/requests/models.py", line 971, in json
return complexjson.loads(self.text, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/init.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/workspace/default/.venv/lib/python3.11/site-packages/codewars_test/test_framework.py", line 112, in wrapper
func()
File "/workspace/default/tests.py", line 75, in random_tests
expected = referance(f"https://www.wikidata.org/wiki/Special:EntityData/Q404.json")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/default/tests.py", line 59, in referance
data = refsession.get(url).json()['entities']
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/workspace/default/.venv/lib/python3.11/site-packages/requests/models.py", line 975, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
bro made the code far more complicated then it should have been. but you can reed it.