chessdotcom_export
Export your chess.com games using the public API. Published-Data API Docs
Installation
Requires python3.6+
To install with pip, run:
pip install chessdotcom-export
Usage
export
chessdotcom_export export --help
Usage: chessdotcom_export export [OPTIONS] USERNAME
Export your chess games
Options:
--help Show this message and exit.
The only required argument is your username, the API serves public data and has no serial rate limit.
inspect
Usage: chessdotcom_export inspect [OPTIONS] FROM_FILE
Parse an exported JSON file and interact with it
Options:
--help Show this message and exit.
Example
The games are described in PGN (which can be parsed using the chess package), with the final board state in FEN, also parseable using chess.Board
$ chessdotcom_export export seanbreckenridge >data.json
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/archives
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/2021/01
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/2021/02
$ chessdotcom_export inspect data.json
In [1]: import io, chess.pgn
In [2]: game = chess.pgn.read_game(io.StringIO(games[0].pgn))
In [3]: for move in game.mainline_moves():
...: print(move)
...:
e2e4
e7e6
b1c3
d8f6
d2d3
f8c5
d3d4
c5d4
f2f3
Library Usage
You can also run the commands from python:
In [1]: import chessdotcom_export
In [2]: games = list(map(lambda j: chessdotcom_export.Game.from_api_response(j), chessdotcom_export.get_player_games("seanbreckenridge")))
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/archives
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/2021/01
Requesting https://api.chess.com/pub/player/seanbreckenridge/games/2021/02
In [3]: games[0].fen
Out[3]: 'r3k2r/5ppp/1Qp5/p3p2q/K3P3/4BP1N/1PP3PP/R4B1R b kq -'
In [4]: export = chessdotcom_export.from_export("data.json")
In [5]: export[0].fen
Out[5]: 'r3k2r/5ppp/1Qp5/p3p2q/K3P3/4BP1N/1PP3PP/R4B1R b kq -'
Tests
git clone 'https://github.com/seanbreckenridge/chessdotcom_export'
cd ./chessdotcom_export
pip install '.[testing]'
mypy ./chessdotcom_export
Metadata
Release files for chessdotcom-export 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chessdotcom_export-0.1.3.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chessdotcom_export-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.2 kB
Release files / chessdotcom_export-0.1.3.tar.gz
| Download URL | chessdotcom_export-0.1.3.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
223c5a91cbd69ff191cde0c438b018c07cf785fe4aedbb211b616a32181e2ef6
|
|
BLAKE2b-256 checksum How to use checksums |
da278d77152e9d0c53888cfe314f30668301d110465e766bfda54e0bef98ceb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.2
|
Release files / chessdotcom_export-0.1.3-py3-none-any.whl
| Download URL | chessdotcom_export-0.1.3-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
43ad8acc07b99489db00ec05c65c5a73210ac09c4b9a45b65f0fa9cb4f222e3e
|
|
BLAKE2b-256 checksum How to use checksums |
5592c3bc38ff205dfe5bba8c2dcd6ace2e586eb3dbef9e4e06f7f65a9aeea8c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.2
|