This is a client library for the lichess.org API. It is designed to be:
Easy to use
Customizable when you need it
Adaptable to API changes
Easy to integrate with python-chess
Have a look at some short examples. For more, check out the full documentation.
Getting a user’s rating:
>>> import lichess.api
>>>
>>> user = lichess.api.user('thibault')
>>> print(user['perfs']['blitz']['rating'])
1617
Checking who’s online and playing:
>>> import lichess.api
>>>
>>> users = list(lichess.api.users_status(['thibault', 'cyanfish']))
>>> online = [u['id'] for u in users if u.get('online')]
>>> playing = [u['id'] for u in users if u.get('playing')]
>>> print(online, playing)
['thibault', 'cyanfish'] ['cyanfish']
Saving a PGN of a user’s last 200 games:
>>> import lichess.api
>>> from lichess.format import SINGLE_PGN
>>>
>>> pgn = lichess.api.user_games('thibault', max=200, format=SINGLE_PGN)
>>> with open('last200.pgn', 'w') as f:
>>> f.write(pgn)
Integrating with python-chess:
>>> import lichess.api
>>> from lichess.format import PYCHESS
>>>
>>> game = lichess.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 python-lichess
Metadata
Release files for python-lichess 0.10
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| python-lichess-0.10.tar.gz | 7.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| python_lichess-0.10-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.1 kB
Release files / python-lichess-0.10.tar.gz
| Download URL | python-lichess-0.10.tar.gz |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6fbd1be99680b66c0628b0aa04b8eb8945218daea38bbd8ac465e852b55407f8
|
|
BLAKE2b-256 checksum How to use checksums |
83b8f354192bf2b6b2b939111a53ebc85fe8e305af208e124d0042a7872474a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.19.8 CPython/3.6.3
|
Release files / python_lichess-0.10-py3-none-any.whl
| Download URL | python_lichess-0.10-py3-none-any.whl |
|---|---|
| Size | 21.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
36d1a339f366b835b877df43668177dd4c465897495e59957042ae2f0091a0e3
|
|
BLAKE2b-256 checksum How to use checksums |
18d2518a8c482f0bfcacb2a23801cad17d984303919d95d410336c22807889d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.18.4 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.19.8 CPython/3.6.3
|
Security for python-lichess 0.10
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.