Api Reference

Apex Api

class apexpy.api.ApexApi(key: str = None)

Represents the Apex api containing all the data requested by ApexRequest.

Parameters:key (str) – The apex legends api key.
name

str Player’s name

key

str api key

legends

List[ApexCharacter] Legends’ data

stats

List[dict] Player’s general stats

id

str Player’s id

_populate(data) → None

Populates object with data

Parameters:data
Returns:None
search(name: str, platform: str) → None

Creates the ApexRequest object that takes care of the api’s communication. Automatically sets variables and call the population method.

Parameters:
  • namestr
  • platformstr Three platforms supported are pc, xbox and psn, they are transformed into their numeric code, 5, 2, 1 respectively.
Returns:

None

Apex Character

class apexpy.characters.ApexCharacter(data)

Represents an Apex legend character

Parameters:data (dict) – Every characters data.
raw_data

dict Raw data

name

str Character’s name

id

str Every character id.

Wraith -> legend_1, Bangalore -> legend_2, Caustic -> legend_3, Mirage -> legend_4, Bloodhound -> legend_5, Gibraltar -> legend_6, Lifeline -> legend_7, Pathfinder -> legend_8

icon

str Character’s icon image

bgimage

str Character’s background image

stats

List[dict] Character’s stats data

Apex request

class apexpy.httprequest.ApexRequest(name: str, platform: int, api_key: str = None)

Represents the asynchronous http call made to the apex legends api

Parameters:
  • name (str) – Player’s name
  • platform (str) – Platform numeric code
  • api_key (str) – Apex key, if not provided directly it’ll be looked in os.environ
platform
name
api_key
headers

dict Headers sent with the call {‘TRN-Api-KEY’: key}

self.req_url

str End point

session() → <sphinx.ext.autodoc.importer._MockObject object at 0x7f3a5639ed68>

Makes the api call. :return: aiohttp.client.ClientResponse

Exceptions

class apexpy.exceptions.CustomBaseException(message='')

Base exception, exceptions are raised depending on the received code from the api.

API_ERROR_MAP = { 401: UnauthorizedError, 400: NotFoundError, 403: UnauthorizedError, 404: PlayerNotFoundError, 500: ServerError}
class apexpy.exceptions.ApiKeyNotProvidedError(message='')

Raised when the api key is not directly provided and doesn’t exist in os.environ

class apexpy.exceptions.NotFoundError(message='')
class apexpy.exceptions.ServerError(message='')
class apexpy.exceptions.UnauthorizedError(message='')