-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
bugSomething isn't workingSomething isn't working
Description
- berserk version: berserk-downstream 0.11.6
- Python version: Python 3.9.5
- Operating System: Mac
Description
Games export API expects integer timestamps, but berserk sends floats.
If you go here: https://lichess.org/api#operation/apiGamesUser
You see that since
and until
expect integers.
utils.to_millis(dt)
does not return integer seconds, it returns floats, per https://docs.python.org/3/library/datetime.html#datetime.datetime.timestamp
As is, the berserk timestamps are completely ignored.
What I Did
Try running the example from the docs, but I changed to a 10 minute window:
start = berserk.utils.to_millis(dt.datetime(2018, 12, 8, 1, 10))
end = berserk.utils.to_millis(dt.datetime(2018, 12, 8, 1, 20))
print(f'Query from {start} to {end}')
games = lichess.games.export_by_player('LeelaChess', since=start, until=end, max=300)
print(f'Found {len(list(games))} Leela games')
start, end = int(start), int(end) # Convert to ints
print(f'Query from {start} to {end}')
games = lichess.games.export_by_player('LeelaChess', since=start, until=end, max=300)
print(f'Found {len(list(games))} Leela games')
Output:
Query from 1544260200000.0 to 1544260800000.0
Found 300 Leela games # Hit max!
Query from 1544260200000 to 1544260800000
Found 3 Leela games # Presumably correct
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working