Package: cohpy
COHPYAn unofficial API Wrapper for Company Of Heroes APITutorialHow to installFunctionalitiesExamplesHow to installpipinstallcohpyVisitPypifor more info!Current API CoverageList all leaderboards ✔️Show players from a leaderboard ️✔️Show match historial from a player ✔️Show personal player stats ✔️Functionalitiesapi_client:
: Interface between wrapper and Company of Heroes APIimportcohpyapi_client=cohpy.get_api_client()api_client.leaderboards():
: Get all leaderboards available from the COH APIParameters:remove_server_status (optional):Default=TrueRemove from the response the server status (redundant).
You can show it setting this param toFalseimportcohpyapi_client=cohpy.get_api_client()api_client.leaderboards()api_client.leaderboards():
: Get all leaderboards available from the COH APIParameters:leaderboard_id (mandatory): Leaderboard identifier extracted from leaderboards() function. You can use raw ints like 2130329 or
Code enum that wraps most used leaderboardscount (optional):Default=200How many players will be showed in the response. From 1 to 200.sort_type (optional):Default=ELOSet 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 wrapperstart (optional):Default=1Sets the position of the first player obtained from the request.remove_server_status (optional):Default=TrueRemove from the response the server status (redundant).
You can show it setting this param toFalseimportcohpyapi_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 APIParameters: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=relicSet the query mode. Options are [relic, steam].remove_server_status (optional):Default=TrueRemove from the response the server status (redundant).
You can show it setting this param toFalseimportcohpyapi_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 APIParameters: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=relicSet the query mode. Options are [relic, steam, alias].remove_server_status (optional):Default=TrueRemove from the response the server status (redundant).
You can show it setting this param toFalseimportcohpyapi_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')ExamplesFirst of all, you'll need an APIClient instance to retrieve the api data:importcohpyapi_client=cohpy.get_api_client()Then you could use the API interface to retrieve the data you want:importcohpyall_leaderboards=api_client.leaderboards()# Returns all leaderboards infoamerican_3v3_leaderboard=api_client.leaderboard(leaderboard_id=cohpy.Codes.USF3v3)# Returns info from specific leaderboardNote thatleaderboard_idcan be a int or a cohpy.Codes instance.