Python wrapper for lichess
Project description
A client for the lichess.org API
This is a client library for the Lichess API. It is designed to be:
-
Easy to use
-
Customizable when you need it
-
Adaptable to API changes
Getting a user's rating:
>>> import lichesspy.api
>>>
>>> user = lichesspy.api.user('thibault')
>>> print(user['perfs']['blitz']['rating'])
1617
Checking who's online and playing:
>>> import lichesspy.api
>>>
>>> users = list(lichesspy.api.users_status(['thibault', 'cyanfish']))
>>> online = [u['id'] for u in users if u.get('online', False)]
>>> playing = [u['id'] for u in users if u.get('playing', False)]
>>> print(online, playing)
['thibault', 'cyanfish'] ['cyanfish']
Saving a PGN of a user's last 200 games:
>>> import lichesspy.api
>>> from lichesspy.format import SINGLE_PGN
>>>
>>> pgn = lichesspy.api.user_games('thibault', max=200, format=SINGLE_PGN)
>>> with open('last200.pgn', 'w') as f:
>>> f.write(pgn)
Integrating with lichesspy:
>>> import lichesspy.api
>>> from lichesspy.format import PYCHESS
>>>
>>> game = lichesspy.api.game('Qa7FJNk2', format=PYCHESS)
>>> print(game.end().board())
. . k . R b r .
. p p r . N p .
p . . . . . . p
. . . . . . . .
. . . p . . . .
P . . P . . . P
. P P . . P P .
. . K R . . . .
Installing
pip install lichesspy
Farewell
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
lichesspy-6.0.5.tar.gz
(9.0 kB
view details)
Built Distribution
File details
Details for the file lichesspy-6.0.5.tar.gz
.
File metadata
- Download URL: lichesspy-6.0.5.tar.gz
- Upload date:
- Size: 9.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b7efa5afb3a9179351a77856c5a7952a4c5094de1fab5314f13667ee414e1ca |
|
MD5 | 44c58ed447c99e74a1ffa9553f8e739d |
|
BLAKE2b-256 | 70f0f1baecf6bc5a0ba59b3fd89819bb6a5dbdf3532881ade520e215f7c0ed9b |
File details
Details for the file lichesspy-6.0.5-py3-none-any.whl
.
File metadata
- Download URL: lichesspy-6.0.5-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb1adebace8424888a6b4da8d921e761c6958a6bb6e5326fc964c574c8711304 |
|
MD5 | 67082a9ca507f305a1553b0039463f6a |
|
BLAKE2b-256 | 7c930be9baa82e192edc467d15b799f2a4a648b06ebf8e1801bd91a35cd79d07 |