Skip to main content

A client for the lichess.org API

Project description

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

Saving a PGN of the user’s last 200 games:

>>> import lichess.api
>>> import lichess.pgn
>>> import itertools
>>>
>>> games = lichess.api.user_games('thibault', with_moves=1)
>>> last_200 = itertools.islice(games, 200)
>>> lichess.pgn.save_games(last_200, 'last200.pgn')

Integrating with python-chess:

>>> import lichess.api
>>> import lichess.pgn
>>> import chess.pgn
>>>
>>> api_game = lichess.api.game('Qa7FJNk2', with_moves=1)
>>> game = chess.pgn.read_game(lichess.pgn.io_from_game(api_game))
>>> 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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-lichess-0.4.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_lichess-0.4-py2.py3-none-any.whl (8.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file python-lichess-0.4.tar.gz.

File metadata

  • Download URL: python-lichess-0.4.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for python-lichess-0.4.tar.gz
Algorithm Hash digest
SHA256 f2bee97106269017125faddba488779571d799a654ea100dccb0289ca7116951
MD5 77257580f50bff2d74662279fb46df04
BLAKE2b-256 55fb9c53fe5f03e548f7a7f8a54e695fd7c5b82b3adb31edbca52efa4e550dd4

See more details on using hashes here.

File details

Details for the file python_lichess-0.4-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for python_lichess-0.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 fa7429551580cddce7783326c36494a8122778dc2451ea35e31cb93cb4067c77
MD5 d746a491653e956b539de803487a38e4
BLAKE2b-256 ec160956351a45aefaa877a0ec10d1da53e58b4bc1e76c120dab1ee324e3885b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page