Metadata-Version: 2.0
Name: python-lichess
Version: 0.5
Summary: A client for the lichess.org API
Home-page: https://github.com/cyanfish/python-lichess
Author: UNKNOWN
Author-email: UNKNOWN
License: GPL3
Keywords: chess lichess api
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Games/Entertainment :: Board Games
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.*
Requires-Dist: requests
Requires-Dist: six

python-lichess: a client for the lichess.org API
================================================

This is a client library for the `lichess.org <https://lichess.org>`_ `API <https://github.com/ornicar/lila#http-api>`_. It is designed to be:

* Easy to use

* Customizable when you need it

* Adaptable to API changes

* Easy to integrate with `python-chess <https://github.com/niklasf/python-chess>`_

Have a look at some short examples. For more, check out the `full documentation <http://python-lichess.readthedocs.io/>`_.

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['online']]
>>> playing = [u['id'] for u in users if u['playing']]
>>> print(online, playing)
['thibault', 'cyanfish'] ['cyanfish']

Saving a PGN of a 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 <https://github.com/niklasf/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


