Skip to main content

No project description provided

Project description

COHPY

An unofficial API Wrapper for Company Of Heroes API

Lint and Tests Stars Badge

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 class that wraps more 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). 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, 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.

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

cohpy-1.1.1.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cohpy-1.1.1-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file cohpy-1.1.1.tar.gz.

File metadata

  • Download URL: cohpy-1.1.1.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-1034-azure

File hashes

Hashes for cohpy-1.1.1.tar.gz
Algorithm Hash digest
SHA256 386dd46beed957e4dc8d0d19fc6eee5678c1c70b245c85210f66d9f47bbb1598
MD5 102f3880cded8aa6f6dcc8094d0eed7d
BLAKE2b-256 fde0f23747edd1a84f35618595fe14e323540a775d52f51a1ad1ea669fe1611d

See more details on using hashes here.

File details

Details for the file cohpy-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: cohpy-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-1034-azure

File hashes

Hashes for cohpy-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd7283fe82cad0ab58b519b62da7667b0dd181ee488a70be5ed5882e271b7165
MD5 02aaf0cee5c97e0f94dd459ce107f660
BLAKE2b-256 4fc5ecea230ff3fd3f1ef54720baa464e0077bf0a1f9b8cb499c01a0e12b2b05

See more details on using hashes here.

Supported by

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