berserk
=======
.. image:: https://github.com/lichess-org/berserk/actions/workflows/test.yml/badge.svg
:target: https://github.com/lichess-org/berserk/actions
:alt: Test status
.. image:: https://badge.fury.io/py/berserk.svg
:target: https://pypi.org/project/berserk/
:alt: PyPI package
.. image:: https://github.com/lichess-org/berserk/actions/workflows/docs.yml/badge.svg
:target: https://lichess-org.github.io/berserk/
:alt: Docs
.. image:: https://img.shields.io/discord/280713822073913354.svg?label=discord&color=green&logo=discord
:target: https://discord.gg/lichess
:alt: Discord
Python client for the `Lichess API <https://lichess.org/api>`_.
This is based on the `original berserk version created by rhgrant10 <https://github.com/rhgrant10/berserk>`_ and the `berserk-downstream fork created by ZackClements <https://github.com/ZackClements/berserk>`_. Big thanks to them and all other contributors!
`Documentation <https://lichess-org.github.io/berserk/>`_
Installation
------------
Requires Python 3.8+. Download and install the latest release:
::
pip3 install berserk
If you have `berserk-downstream` installed, make sure to uninstall it first!
Features
--------
* handles (ND)JSON and PGN formats at user's discretion
* token auth session
* easy integration with OAuth2
* automatically converts time values to datetimes
Usage
-----
You can use any ``requests.Session``-like object as a session, including those
from ``requests_oauth``. A simple token session is included, as shown below:
.. code:: python
import berserk
session = berserk.TokenSession(API_TOKEN)
client = berserk.Client(session=session)
Most of the API is available:
.. code:: python
client.account.get
client.account.get_email
client.account.get_preferences
client.account.get_kid_mode
client.account.set_kid_mode
client.account.upgrade_to_bot
client.analysis.get_cloud_evaluation
client.board.stream_incoming_events
client.board.seek
client.board.stream_game_state
client.board.make_move
client.board.post_message
client.board.get_game_chat
client.board.abort_game
client.board.resign_game
client.board.handle_draw_offer
client.board.offer_draw
client.board.accept_draw
client.board.decline_draw
client.board.handle_takeback_offer
client.board.offer_takeback
client.board.accept_takeback
client.board.decline_takeback
client.board.claim_victory
client.board.go_berserk
client.bots.get_online_bots
client.bots.stream_incoming_events
client.bots.stream_game_state
client.bots.make_move
client.bots.post_message
client.bots.abort_game
client.bots.resign_game
client.bots.accept_challenge
client.bots.decline_challenge
client.broadcasts.get_official
client.broadcasts.create
client.broadcasts.get
client.broadcasts.update
client.broadcasts.push_pgn_update
client.broadcasts.create_round
client.broadcasts.get_round
client.broadcasts.update_round
client.broadcasts.get_round_pgns
client.broadcasts.get_pgns
client.broadcasts.stream_round
client.bulk_pairings.get_upcoming
client.bulk_pairings.create
client.bulk_pairings.start_clocks
client.bulk_pairings.cancel
client.challenges.get_mine
client.challenges.create
client.challenges.create_ai
client.challenges.create_open
client.challenges.create_with_accept
client.challenges.accept
client.challenges.decline
client.challenges.cancel
client.challenges.start_clocks
client.challenges.add_time_to_opponent_clock
client.challenges.create_tokens_for_multiple_users
client.explorer.get_lichess_games
client.explorer.get_masters_games
client.explorer.get_player_games
client.explorer.stream_player_games
client.explorer.get_otb_master_game
client.external_engine.get
client.external_engine.get_by_id
client.external_engine.create
client.external_engine.update
client.external_engine.delete
client.games.export
client.games.export_ongoing_by_player
client.games.export_by_player
client.games.export_multi
client.games.get_among_players
client.games.stream_games_by_ids
client.games.add_game_ids_to_stream
client.games.get_ongoing
client.games.stream_game_moves
client.games.get_tv_channels
client.games.import_game
client.messaging.send
client.oauth.test_tokens
client.puzzles.get_daily
client.puzzles.get
client.puzzles.get_puzzle_activity
client.puzzles.get_puzzle_dashboard
client.puzzles.get_storm_dashboard
client.puzzles.create_race
client.relations.get_users_followed
client.relations.follow
client.relations.unfollow
client.simuls.get
client.studies.export_chapter
client.studies.export
client.studies.export_by_username
client.tablebase.look_up
client.tablebase.standard
client.tablebase.atomic
client.tablebase.antichess
client.teams.get_members
client.teams.join
client.teams.leave
client.teams.kick_member
client.teams.get_join_requests
client.teams.accept_join_request
client.teams.decline_join_request
client.teams.get_team
client.teams.teams_of_player
client.teams.get_popular
client.teams.search
client.teams.message_all_members
client.tournaments.edit_swiss
client.tournaments.get
client.tournaments.get_tournament
client.tournaments.get_swiss
client.tournaments.get_team_standings
client.tournaments.update_team_battle
client.tournaments.create_arena
client.tournaments.create_swiss
client.tournaments.export_arena_games
client.tournaments.export_swiss_games
client.tournaments.export_swiss_trf
client.tournaments.arena_by_team
client.tournaments.swiss_by_team
client.tournaments.join_arena
client.tournaments.join_swiss
client.tournaments.terminate_arena
client.tournaments.terminate_swiss
client.tournaments.tournaments_by_user
client.tournaments.stream_results
client.tournaments.stream_swiss_results
client.tournaments.stream_by_creator
client.tournaments.withdraw_arena
client.tournaments.withdraw_swiss
client.tournaments.schedule_swiss_next_round
client.tv.get_current_games
client.tv.stream_current_game
client.tv.get_best_ongoing
client.users.get_realtime_statuses
client.users.get_all_top_10
client.users.get_leaderboard
client.users.get_public_data
client.users.get_activity_feed
client.users.get_by_id
client.users.get_by_team
client.users.get_live_streamers
client.users.get_rating_history
client.users.get_crosstable
client.users.get_user_performance
client.users.get_by_autocomplete
Details for each function can be found in the `documentation <https://lichess-org.github.io/berserk/>`_.
Raw data
{
"_id": null,
"home_page": "https://github.com/lichess-org/berserk",
"name": "berserk",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8,<4.0",
"maintainer_email": "",
"keywords": "lichess,chess,api,client",
"author": "Lichess",
"author_email": "contact@lichess.org",
"download_url": "https://files.pythonhosted.org/packages/8b/83/c35e86fcd96cef66dac6f19dd2950e977828ac461afc4f179a41bf951bee/berserk-0.13.2.tar.gz",
"platform": null,
"description": "berserk\n=======\n\n.. image:: https://github.com/lichess-org/berserk/actions/workflows/test.yml/badge.svg\n :target: https://github.com/lichess-org/berserk/actions\n :alt: Test status\n\n.. image:: https://badge.fury.io/py/berserk.svg\n :target: https://pypi.org/project/berserk/\n :alt: PyPI package\n\n.. image:: https://github.com/lichess-org/berserk/actions/workflows/docs.yml/badge.svg\n :target: https://lichess-org.github.io/berserk/\n :alt: Docs\n\n.. image:: https://img.shields.io/discord/280713822073913354.svg?label=discord&color=green&logo=discord\n :target: https://discord.gg/lichess\n :alt: Discord\n\nPython client for the `Lichess API <https://lichess.org/api>`_.\n\nThis is based on the `original berserk version created by rhgrant10 <https://github.com/rhgrant10/berserk>`_ and the `berserk-downstream fork created by ZackClements <https://github.com/ZackClements/berserk>`_. Big thanks to them and all other contributors!\n\n`Documentation <https://lichess-org.github.io/berserk/>`_\n\nInstallation\n------------\n\nRequires Python 3.8+. Download and install the latest release:\n::\n\n pip3 install berserk\n\nIf you have `berserk-downstream` installed, make sure to uninstall it first!\n\nFeatures\n--------\n\n* handles (ND)JSON and PGN formats at user's discretion\n* token auth session\n* easy integration with OAuth2\n* automatically converts time values to datetimes\n\nUsage\n-----\n\nYou can use any ``requests.Session``-like object as a session, including those\nfrom ``requests_oauth``. A simple token session is included, as shown below:\n\n.. code:: python\n\n import berserk\n\n session = berserk.TokenSession(API_TOKEN)\n client = berserk.Client(session=session)\n\n\nMost of the API is available:\n\n.. code:: python\n\n client.account.get\n client.account.get_email\n client.account.get_preferences\n client.account.get_kid_mode\n client.account.set_kid_mode\n client.account.upgrade_to_bot\n\n client.analysis.get_cloud_evaluation\n\n client.board.stream_incoming_events\n client.board.seek\n client.board.stream_game_state\n client.board.make_move\n client.board.post_message\n client.board.get_game_chat\n client.board.abort_game\n client.board.resign_game\n client.board.handle_draw_offer\n client.board.offer_draw\n client.board.accept_draw\n client.board.decline_draw\n client.board.handle_takeback_offer\n client.board.offer_takeback\n client.board.accept_takeback\n client.board.decline_takeback\n client.board.claim_victory\n client.board.go_berserk\n\n client.bots.get_online_bots\n client.bots.stream_incoming_events\n client.bots.stream_game_state\n client.bots.make_move\n client.bots.post_message\n client.bots.abort_game\n client.bots.resign_game\n client.bots.accept_challenge\n client.bots.decline_challenge\n\n client.broadcasts.get_official\n client.broadcasts.create\n client.broadcasts.get\n client.broadcasts.update\n client.broadcasts.push_pgn_update\n client.broadcasts.create_round\n client.broadcasts.get_round\n client.broadcasts.update_round\n client.broadcasts.get_round_pgns\n client.broadcasts.get_pgns\n client.broadcasts.stream_round\n\n client.bulk_pairings.get_upcoming\n client.bulk_pairings.create\n client.bulk_pairings.start_clocks\n client.bulk_pairings.cancel\n\n client.challenges.get_mine\n client.challenges.create\n client.challenges.create_ai\n client.challenges.create_open\n client.challenges.create_with_accept\n client.challenges.accept\n client.challenges.decline\n client.challenges.cancel\n client.challenges.start_clocks\n client.challenges.add_time_to_opponent_clock\n client.challenges.create_tokens_for_multiple_users\n\n client.explorer.get_lichess_games\n client.explorer.get_masters_games\n client.explorer.get_player_games\n client.explorer.stream_player_games\n client.explorer.get_otb_master_game\n\n client.external_engine.get\n client.external_engine.get_by_id\n client.external_engine.create\n client.external_engine.update\n client.external_engine.delete\n\n client.games.export\n client.games.export_ongoing_by_player\n client.games.export_by_player\n client.games.export_multi\n client.games.get_among_players\n client.games.stream_games_by_ids\n client.games.add_game_ids_to_stream\n client.games.get_ongoing\n client.games.stream_game_moves\n client.games.get_tv_channels\n client.games.import_game\n\n client.messaging.send\n\n client.oauth.test_tokens\n\n client.puzzles.get_daily\n client.puzzles.get\n client.puzzles.get_puzzle_activity\n client.puzzles.get_puzzle_dashboard\n client.puzzles.get_storm_dashboard\n client.puzzles.create_race\n\n client.relations.get_users_followed\n client.relations.follow\n client.relations.unfollow\n\n client.simuls.get\n\n client.studies.export_chapter\n client.studies.export\n client.studies.export_by_username\n\n client.tablebase.look_up\n client.tablebase.standard\n client.tablebase.atomic\n client.tablebase.antichess\n\n client.teams.get_members\n client.teams.join\n client.teams.leave\n client.teams.kick_member\n client.teams.get_join_requests\n client.teams.accept_join_request\n client.teams.decline_join_request\n client.teams.get_team\n client.teams.teams_of_player\n client.teams.get_popular\n client.teams.search\n client.teams.message_all_members\n\n client.tournaments.edit_swiss\n client.tournaments.get\n client.tournaments.get_tournament\n client.tournaments.get_swiss\n client.tournaments.get_team_standings\n client.tournaments.update_team_battle\n client.tournaments.create_arena\n client.tournaments.create_swiss\n client.tournaments.export_arena_games\n client.tournaments.export_swiss_games\n client.tournaments.export_swiss_trf\n client.tournaments.arena_by_team\n client.tournaments.swiss_by_team\n client.tournaments.join_arena\n client.tournaments.join_swiss\n client.tournaments.terminate_arena\n client.tournaments.terminate_swiss\n client.tournaments.tournaments_by_user\n client.tournaments.stream_results\n client.tournaments.stream_swiss_results\n client.tournaments.stream_by_creator\n client.tournaments.withdraw_arena\n client.tournaments.withdraw_swiss\n client.tournaments.schedule_swiss_next_round\n\n client.tv.get_current_games\n client.tv.stream_current_game\n client.tv.get_best_ongoing\n\n client.users.get_realtime_statuses\n client.users.get_all_top_10\n client.users.get_leaderboard\n client.users.get_public_data\n client.users.get_activity_feed\n client.users.get_by_id\n client.users.get_by_team\n client.users.get_live_streamers\n client.users.get_rating_history\n client.users.get_crosstable\n client.users.get_user_performance\n client.users.get_by_autocomplete\n\nDetails for each function can be found in the `documentation <https://lichess-org.github.io/berserk/>`_.\n",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "Python client for the lichess API",
"version": "0.13.2",
"project_urls": {
"Changelog": "https://lichess-org.github.io/berserk/changelog.html",
"Discord Server": "https://discord.gg/lichess",
"Documentation": "https://lichess-org.github.io/berserk/",
"Homepage": "https://github.com/lichess-org/berserk",
"Issue Tracker": "https://github.com/lichess-org/berserk/issues",
"Repository": "https://github.com/lichess-org/berserk"
},
"split_keywords": [
"lichess",
"chess",
"api",
"client"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "af3e8b2c89d97212e5de0b433961bf76e4126c18ff3cde15e0e099993123cc5d",
"md5": "f6977c008cc333597a644c7609577b58",
"sha256": "0f7fc40f152370924cb05a77c3f1c357a91e8ff0db60d23c14f0f16216b632a8"
},
"downloads": -1,
"filename": "berserk-0.13.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "f6977c008cc333597a644c7609577b58",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8,<4.0",
"size": 74479,
"upload_time": "2023-12-04T05:26:13",
"upload_time_iso_8601": "2023-12-04T05:26:13.615850Z",
"url": "https://files.pythonhosted.org/packages/af/3e/8b2c89d97212e5de0b433961bf76e4126c18ff3cde15e0e099993123cc5d/berserk-0.13.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8b83c35e86fcd96cef66dac6f19dd2950e977828ac461afc4f179a41bf951bee",
"md5": "7e9732e9a6dcfc56c0799a8a9693cd0a",
"sha256": "96c3ff3a10407842019e5e6bf3233080030419e4eba333bbd4234a86b4eff86f"
},
"downloads": -1,
"filename": "berserk-0.13.2.tar.gz",
"has_sig": false,
"md5_digest": "7e9732e9a6dcfc56c0799a8a9693cd0a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8,<4.0",
"size": 55539,
"upload_time": "2023-12-04T05:26:16",
"upload_time_iso_8601": "2023-12-04T05:26:16.303615Z",
"url": "https://files.pythonhosted.org/packages/8b/83/c35e86fcd96cef66dac6f19dd2950e977828ac461afc4f179a41bf951bee/berserk-0.13.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-04 05:26:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "lichess-org",
"github_project": "berserk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "berserk"
}