Can't call get_activity_feed
jube-pimy opened this issue · 8 comments
- berserk version: berserk-downstream:0.11.6
- Python version: Python 3.9.5
- Operating System: Windows 10
Description
I'm trying to get de recent activity of my account on lichess, but receive an error when looking for activity if user exists.
If user doesn't exists on Lichess, then I receive an empty response ( which seems OK for me )
What I Did
def get_activity():
API_TOKEN = 'abcdef1234'
session = berserk.TokenSession(API_TOKEN)
client = berserk.Client(session=session)
print(client.users.get_activity_feed('username'))
if name == 'main':
get_activity()
C:\Users\user\Lichess\venv\Scripts\python.exe C:/Users/user/PycharmProjects/LichessGifDiscorder/main.py
Traceback (most recent call last):
File "C:\Users\user\Lichess\main.py", line 32, in <module>
get_activity()
File "C:\Users\user\Lichess\main.py", line 28, in get_activity
print(client.users.get_activity_feed('Pimy_1234'))
File "C:\Users\user\Lichess\venv\lib\site-packages\berserk\clients.py", line 235, in get_activity_feed
return self._r.get(path, converter=models.Activity.convert)
File "C:\Users\user\Lichess\venv\lib\site-packages\berserk\session.py", line 60, in get
return self.request('GET', *args, **kwargs)
File "C:\Users\user\Lichess\venv\lib\site-packages\berserk\session.py", line 56, in request
return fmt.handle(response, is_stream=is_stream, converter=converter)
File "C:\Users\user\Lichess\venv\lib\site-packages\berserk\formats.py", line 35, in handle
return converter(self.parse(response))
File "C:\Users\user\Lichess\venv\lib\site-packages\berserk\models.py", line 15, in convert
return [cls.convert_one(v) for v in data]
File "C:\Users\user\Lichess\venv\lib\site-packages\berserk\models.py", line 15, in <listcomp>
return [cls.convert_one(v) for v in data]
File "C:\Users\user\Lichess\venv\lib\site-packages\berserk\models.py", line 21, in convert_one
data[k] = cls.conversions[k](data[k])
File "C:\Users\user\Lichess\venv\lib\site-packages\berserk\utils.py", line 63, in convert
data[k] = func(data[k])
File "C:\Users\user\Lichess\venv\lib\site-packages\berserk\utils.py", line 25, in datetime_from_seconds
return datetime.fromtimestamp(ts, timezone.utc)
OSError: [Errno 22] Invalid argument
Process finished with exit code 1
Hi @jube-pimy,
I tryed and found the bug.
Line 42 in 1b000a4
Replace datetime_from_seconds
by datetime_from_millis
.
#38 Fix it
Nice news ! Thanks :)
I'll try this as soon as possible
Hi @jube-pimy,
I tryed and found the bug.
Line 42 in 1b000a4
Replace
datetime_from_seconds
bydatetime_from_millis
.
Much appreciated.
Hello @Virinas-code !
(Even if late...) Thanks for the help, i'll try this with the fix !
Hello @Virinas-code !
(Even if late...) Thanks for the help, i'll try this with the fix !
Thank you !
hello, just a quick message to confirm the issue and the fix but it would be great to have it in an official version :)
Yes, but the PR is going to be merged.