core

  • Functions for interacting with the web services Core API

delete(token: WebServicesToken, endpoint: str, params: dict = {}, body: dict = {}) dict | list[source]
  • sends a DELETE request to the Core API

Parameters:
  • token (auth.WebServicesToken) –

    • authentication token

  • endpoint (str) –

    • desired endpoint

    • base URL is optional

    • leading forward slash is optional

    • trailing parameters are optional, e.g. ?param1=true&param2=0

  • params (dict) –

    • request parameters, if applicable

    • if you put parameters at the end of the endpoint, do not put them here or they will be duplicated

  • body (dict) –

    • request body if, applicable

    • default: {} (empty)

Returns:

  • response body

Return type:

dict | list

get(token: WebServicesToken, endpoint: str, params: dict = {}) dict | list[source]
  • sends a GET request to the Core API

Parameters:
  • token (auth.WebServicesToken) –

    • authentication token

  • endpoint (str) –

    • desired endpoint

    • base URL is optional

    • leading forward slash is optional

    • trailing parameters are optional, e.g. ?param1=true&param2=0

  • params (dict) –

    • request parameters, if applicable

    • if you put parameters at the end of the endpoint, do not put them here or they will be duplicated

Returns:

  • response body

Return type:

dict | list

get_map_info(token: WebServicesToken, uids: Iterable[str]) list[dict][source]
Parameters:
  • token (auth.WebServicesToken) –

    • authentication token

  • uids (Iterable[str]) –

    • map UIDs

Returns:

  • map info

Return type:

list[dict]

get_routes(token: WebServicesToken, usage: str = 'Client') dict[source]
Parameters:
  • token (auth.WebServicesToken) –

    • authentication token

  • usage (str) –

    • which authorization type to get routes for

    • ’Client’ is for a Ubisoft/service account, while ‘Server’ is for a dedicated server account

    • valid: ‘Client’, ‘Server’

    • default: ‘Client’

Returns:

  • valid routes for given usage

Return type:

dict

get_trophies_history(token: ServiceToken, account_id: str = '', count: int = 100, offset: int = 0) dict[source]
Parameters:
  • token (auth.ServiceToken) –

    • authentication token

  • account_id (str) –

    • account ID to get data for

    • may be a different ID to the one being used for authentication

    • if not given, the currently authenticated account will be used

    • default: ‘’ (empty)

  • count (int) –

    • number of history entries to get

    • if you set this too high, the request may time out (response 504)

    • maximum: 1,000

    • default: 100

  • offset (int) –

    • number of history entries to skip, looking backwards from the most recent

    • default: 0

Returns:

  • history entries sorted newest to oldest

Return type:

dict

get_trophies_last_year_summary(token: ServiceToken, account_id: str = '') dict[source]
Parameters:
  • token (auth.ServiceToken) –

    • authentication token

  • account_id (str) –

    • account ID to get data for

    • may be a different ID to the one being used for authentication

    • if not given, the currently authenticated account will be used

    • default: ‘’ (empty)

Returns:

  • data on given account

Return type:

dict

get_zones(token: WebServicesToken) list[dict][source]
Parameters:

token (auth.WebServicesToken) –

  • authentication token

Returns:

  • zones sorted alphabetically by name

Return type:

list[dict]

head(token: WebServicesToken, endpoint: str, params: dict = {}) dict | list[source]
  • sends a HEAD request to the Core API

Parameters:
  • token (auth.WebServicesToken) –

    • authentication token

  • endpoint (str) –

    • desired endpoint

    • base URL is optional

    • leading forward slash is optional

    • trailing parameters are optional, e.g. ?param1=true&param2=0

  • params (dict) –

    • request parameters, if applicable

    • if you put parameters at the end of the endpoint, do not put them here or they will be duplicated

Returns:

  • response body

Return type:

dict | list

options(token: WebServicesToken, endpoint: str, params: dict = {}, body: dict = {}) dict | list[source]
  • sends an OPTIONS request to the Core API

Parameters:
  • token (auth.WebServicesToken) –

    • authentication token

  • endpoint (str) –

    • desired endpoint

    • base URL is optional

    • leading forward slash is optional

    • trailing parameters are optional, e.g. ?param1=true&param2=0

  • params (dict) –

    • request parameters, if applicable

    • if you put parameters at the end of the endpoint, do not put them here or they will be duplicated

  • body (dict) –

    • request body, if applicable

    • default: {} (empty)

Returns:

  • response body

Return type:

dict | list

patch(token: WebServicesToken, endpoint: str, params: dict = {}, body: dict = {}) dict | list[source]
  • sends a PATCH request to the Core API

Parameters:
  • token (auth.WebServicesToken) –

    • authentication token

  • endpoint (str) –

    • desired endpoint

    • base URL is optional

    • leading forward slash is optional

    • trailing parameters are optional, e.g. ?param1=true&param2=0

  • params (dict) –

    • request parameters, if applicable

    • if you put parameters at the end of the endpoint, do not put them here or they will be duplicated

  • body (dict) –

    • request body, if applicable

    • default: {} (empty)

Returns:

  • response body

Return type:

dict | list

post(token: WebServicesToken, endpoint: str, params: dict = {}, body: dict = {}) dict | list[source]
  • sends a POST request to the Core API

Parameters:
  • token (auth.WebServicesToken) –

    • authentication token

  • endpoint (str) –

    • desired endpoint

    • base URL is optional

    • leading forward slash is optional

    • trailing parameters are optional, e.g. ?param1=true&param2=0

  • params (dict) –

    • request parameters, if applicable

    • if you put parameters at the end of the endpoint, do not put them here or they will be duplicated

  • body (dict) –

    • request body, if applicable

    • default: {} (empty)

Returns:

  • response body

Return type:

dict | list

put(token: WebServicesToken, endpoint: str, params: dict = {}, body: dict = {}) dict | list[source]
  • sends a PUT request to the Core API

Parameters:
  • token (auth.WebServicesToken) –

    • authentication token

  • endpoint (str) –

    • desired endpoint

    • base URL is optional

    • leading forward slash is optional

    • trailing parameters are optional, e.g. ?param1=true&param2=0

  • params (dict) –

    • request parameters, if applicable

    • if you put parameters at the end of the endpoint, do not put them here or they will be duplicated

  • body (dict) –

    • request body, if applicable

    • default: {} (empty)

Returns:

  • response body

Return type:

dict | list