Lightweight Python wrapper for the Challonge API
Project description
pychallonge
Lightweight Python wrapper for the Challonge API. The pychallonge module was created by Russ Amos
Python version support
3.10+
Installation
For the stable version
pip install pychallonge
For latest development
pip install -e git+https://github.com/ZEDGR/pychallonge#egg=pychallonge
Usage
import challonge
# Tell pychallonge about your [Challonge API credentials](http://api.challonge.com/v1).
challonge.set_credentials("your_challonge_username", "your_api_key")
# Retrieve a tournament by its id (or its url).
tournament = challonge.tournaments.show(3272)
# Tournaments, matches, and participants are all represented as normal Python dicts.
print(tournament["id"]) # 3272
print(tournament["name"]) # My Awesome Tournament
print(tournament["started_at"]) # None
# Retrieve the participants for a given tournament.
participants = challonge.participants.index(tournament["id"])
print(len(participants)) # 13
# Mutations (POST/PUT) return the updated resource directly.
tournament = challonge.tournaments.start(tournament["id"])
print(tournament["started_at"]) # 2011-07-31 16:16:02-04:00
See challonge.com for full API documentation.
API Issues
The Challonge API has some issues with the attachments endpoints. When uploading an attachment with a file (asset), the API returns a 500 internal server error. This issue has been reported to Challonge.
The check-in undo endpoint has unexpected behaviour: the checked_in field in
the API response remains True even after a successful undo. The participant is
correctly marked as not checked in on the website.
Datetime fields from the API carry inconsistent timezone offsets. Pychallonge
normalises these to your machine's local timezone. You can also set a specific
timezone with the set_timezone function.
Running the tests
Tests make real API calls and require a Challonge account. Set CHALLONGE_USER
and CHALLONGE_KEY in your environment before running.
$ git clone https://github.com/ZEDGR/pychallonge
$ cd pychallonge
$ CHALLONGE_USER=my_user CHALLONGE_KEY=my_api_key uv run python -m unittest tests.py
Note that several tournaments are created and destroyed over the course of the tests. If any test fails mid-run, orphaned tournaments can be cleaned up as follows:
import challonge
challonge.set_credentials("my_user", "my_api_key")
for t in challonge.tournaments.index():
if t["name"].startswith("pychal"):
challonge.tournaments.destroy(t["id"])
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pychallonge-2.0.0.tar.gz.
File metadata
- Download URL: pychallonge-2.0.0.tar.gz
- Upload date:
- Size: 30.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6b6daa4a5b34af22ef163708bc7bccd082f833b76bb416e128058a23dc29ecd
|
|
| MD5 |
376fec6cfae4ce80f938c7b4df8d1471
|
|
| BLAKE2b-256 |
60ce3ea31877b15c1151db6013a3d165befda70800fa80f228fd6a032c1bf64a
|
Provenance
The following attestation bundles were made for pychallonge-2.0.0.tar.gz:
Publisher:
publish.yml on ZEDGR/pychallonge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pychallonge-2.0.0.tar.gz -
Subject digest:
f6b6daa4a5b34af22ef163708bc7bccd082f833b76bb416e128058a23dc29ecd - Sigstore transparency entry: 1616052866
- Sigstore integration time:
-
Permalink:
ZEDGR/pychallonge@68351654eefacdd572c6c2a400df09e1567cb7fd -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/ZEDGR
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@68351654eefacdd572c6c2a400df09e1567cb7fd -
Trigger Event:
release
-
Statement type:
File details
Details for the file pychallonge-2.0.0-py3-none-any.whl.
File metadata
- Download URL: pychallonge-2.0.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f5350bfc5f6d7c2905ddb9c2c09e3fed38df68c7e85c2d06c9dad4c34c9eed9
|
|
| MD5 |
f21f50ee77fd5af5df190e862eb3e04c
|
|
| BLAKE2b-256 |
5a374d180fb7565ad1a6095556f04ab8ccada918fd273fbecf63569209f19899
|
Provenance
The following attestation bundles were made for pychallonge-2.0.0-py3-none-any.whl:
Publisher:
publish.yml on ZEDGR/pychallonge
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pychallonge-2.0.0-py3-none-any.whl -
Subject digest:
3f5350bfc5f6d7c2905ddb9c2c09e3fed38df68c7e85c2d06c9dad4c34c9eed9 - Sigstore transparency entry: 1616052869
- Sigstore integration time:
-
Permalink:
ZEDGR/pychallonge@68351654eefacdd572c6c2a400df09e1567cb7fd -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/ZEDGR
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@68351654eefacdd572c6c2a400df09e1567cb7fd -
Trigger Event:
release
-
Statement type: