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¶m2=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¶m2=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]
gets info on multiple maps from their UIDs
https://webservices.openplanet.dev/core/maps/info-multiple-uid
- 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]
gets the valid Core API routes
- 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]
gets a list of trophy gain history
https://webservices.openplanet.dev/core/accounts/trophy-history
- 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]
gets a summary of the trophies gained in the last year
https://webservices.openplanet.dev/core/accounts/trophy-summary
- 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]
gets the valid regions a player may choose from
- 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¶m2=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¶m2=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¶m2=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¶m2=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¶m2=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