Skip to main content

Python Wrapper around Chess.com API

Project description

Python wrapper for Chess.com Public API

Description & Implementation

Python wrapper for Chess.com API which provides public data from the chess.com website. All endpoints provided by Chess.com's API are available in the respectively named methods.

The package is avaliable on the Python Package Index.

Install the package with: pip install chess.com

Usage

Refer to package and api docs for information on the usage.

Retrieving Data

All the functions return a ChessDotComResponse object. The data can be accessed in dictionary format or via attributes:

from chessdotcom import get_player_profile

response = get_player_profile("fabianocaruana")

player_name = response.json['player']['name']
#or
player_name = response.player.name

Configuring the Client object

The project uses requests package to interact with the API. Headers and proxies can be set through the Client object. Official Chess.com documentation recommends adding a User-Agent header.

#optional
from chessdotcom import Client

Client.headers["User-Agent"] = (
    "My Python Application. "
    "Contact me at email@example.com"
)

All the methods from the module will now include the header when making a request to the API.

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

chess.com-1.6.4.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

chess.com-1.6.4-py3-none-any.whl (9.0 kB view hashes)

Uploaded Python 3

Supported by

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