COHPY
Tutorial
How to install
pip install cohpy
Visit Pypi for more info!
Current API Coverage
- List all leaderboards ✔️
- Show players from a leaderboard ️✔️
- Show match historial from a player ✔️
- Show personal player stats ✔️
Functionalities
api_client: : Interface between wrapper and Company of Heroes API
import cohpy
api_client = cohpy.get_api_client()
api_client.leaderboards(): : Get all leaderboards available from the COH API
- Parameters:
- remove_server_status (optional): Default=True Remove from the response the server status (redundant). You can show it setting this param to False
import cohpy
api_client = cohpy.get_api_client()
api_client.leaderboards()
api_client.leaderboards(): : Get all leaderboards available from the COH API
- Parameters:
- leaderboard_id (mandatory): Leaderboard identifier extracted from leaderboards() function. You can use raw ints like 2130329 or Code enum that wraps most used leaderboards
- count (optional): Default=200 How many players will be showed in the response. From 1 to 200.
- sort_type (optional): Default=ELO Set the order of the leaderboard based on wins or elo. You can use ints like 0 (ELO) or 1 (WINS). Also you can use SortType wrapper
- start (optional): Default=1 Sets the position of the first player obtained from the request.
- remove_server_status (optional): Default=True Remove from the response the server status (redundant). You can show it setting this param to False
import cohpy
api_client = cohpy.get_api_client()
api_client.leaderboard(leaderboard_id=cohpy.Codes.USF3v3, sort_type=cohpy.SortType.ELO)
api_client.match_history(): : Get all leaderboards available from the COH API
- Parameters:
- profile_params (mandatory): Player id. Can be steam profile id or relic id (Don't forget to set the mode). Can be a list of ints or strings. Steam queries must follow /steam/[0-9]+
- mode (optional): Default=relic Set the query mode. Options are [relic, steam].
- remove_server_status (optional): Default=True Remove from the response the server status (redundant). You can show it setting this param to False
import cohpy
api_client = cohpy.get_api_client()
api_client.match_history(profile_params=[1, 2])
api_client.match_history(profile_params=1)
api_client.match_history(profile_params='/steam/123456789', mode='steam')
api_client.match_history(profile_params=['/steam/123456789', '/steam/123456789'], mode='steam')
api_client.personal_stats(): : Get all leaderboards available from the COH API
- Parameters:
- profile_params (mandatory): Player id. Can be steam profile id, relic id or alias (Don't forget to set the mode). It can be a list of ints or strings. Steam queries must follow /steam/[0-9]+ pattern.
- mode (optional): Default=relic Set the query mode. Options are [relic, steam, alias].
- remove_server_status (optional): Default=True Remove from the response the server status (redundant). You can show it setting this param to False
import cohpy
api_client = cohpy.get_api_client()
api_client.personal_stats(profile_params=[1, 2])
api_client.personal_stats(profile_params=1)
api_client.personal_stats(profile_params='/steam/123456789', mode='steam')
api_client.personal_stats(profile_params=['/steam/123456789', '/steam/123456789'], mode='steam')
api_client.personal_stats(profile_params='yoursuperalias', mode='alias')
api_client.personal_stats(profile_params=['yoursuperalias', 'awesomealias'], mode='alias')
Examples
First of all, you'll need an APIClient instance to retrieve the api data:
import cohpy
api_client = cohpy.get_api_client()
Then you could use the API interface to retrieve the data you want:
import cohpy
all_leaderboards = api_client.leaderboards() # Returns all leaderboards info
american_3v3_leaderboard = api_client.leaderboard(leaderboard_id=cohpy.Codes.USF3v3) # Returns info from specific leaderboard
Note that leaderboard_id can be a int or a cohpy.Codes instance.
Release files for cohpy 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| cohpy-1.1.4.tar.gz | 8.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cohpy-1.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.8 kB
Release files / cohpy-1.1.4.tar.gz
| Download URL | cohpy-1.1.4.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b7dfc86999d976b00bed2e549abc1fdb8d0d2aaa02245db625c7b7e4218b18c4
|
|
BLAKE2b-256 checksum How to use checksums |
75a36840cc372439142a08d79b8baa88c24fdc31ac334cfea981e27da99f1edb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1041-azure
|
Release files / cohpy-1.1.4-py3-none-any.whl
| Download URL | cohpy-1.1.4-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6927fc5d7aa18b8f79faaae3e85dc2133b6af215b32b7bad4a0afa198852311d
|
|
BLAKE2b-256 checksum How to use checksums |
d21180db99bd3bd0e3e214deffce97ee394ecaa900d80466538452da73ecdcf1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.10.6 Linux/5.15.0-1041-azure
|