An error related to date format occur when trying to get the pending clash of code (with codingame.Client().get_pending_clash_of_code())
To Reproduce
Just call codingame.Client().get_pending_clash_of_code() and you will get this error:
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/codingame/client/sync.py", line 128, in get_pending_clash_of_code
return ClashOfCode(self._state, data[0]) # pragma: no cover
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/codingame/clash_of_code.py", line 130, in __init__
self.creation_time = to_datetime(data["creationTime"])
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/codingame/utils.py", line 102, in to_datetime
return datetime.strptime(data, DT_FORMAT)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/_strptime.py", line 568, in _strptime_datetime
tt, fraction, gmtoff_fraction = _strptime(data_string, format)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/_strptime.py", line 349, in _strptime
raise ValueError("time data %r does not match format %r" %
ValueError: time data 'Feb 10, 2023, 11:42:01 PM' does not match format '%b %d, %Y %I:%M:%S %p'
Environment information:
OS: macOS Sierra 10.12.6
Python version: 3.9.7
codingame module version: 1.4.0
Suggestion
I just added a comma after the %Y in DT_FORMAT from the codingame/utils.py file, line 95, in order to match the data, like this: DT_FORMAT = "%b %d, %Y, %I:%M:%S %p".
It solved the problem for me.
Description
An error related to date format occur when trying to get the pending clash of code (with
codingame.Client().get_pending_clash_of_code()
)To Reproduce
Just call
codingame.Client().get_pending_clash_of_code()
and you will get this error:Environment information:
Suggestion
I just added a comma after the %Y in DT_FORMAT from the
codingame/utils.py
file, line 95, in order to match the data, like this:DT_FORMAT = "%b %d, %Y, %I:%M:%S %p"
. It solved the problem for me.