-
Notifications
You must be signed in to change notification settings - Fork 5
Kano Profile API documentation
To communicate with kano-profile you can use a command line tool: kano-profile-cli or direct Python import if you are in Python. The Python import is recommended as it's faster.
python: kano.profile.profile load_profile()
Returns the main profile dict. Data in this dict include:
- kanoworld_id
- kanoworld_username
- save_date
- token
- username_linux
cli: load_app_state_variable app_name variable value
python: kano.profile.apps load_app_state_variable(app_name, variable)
returns a variable of app
if variable not found:
- cli returns
VARIABLE_NOT_FOUND - Python returns none
cli with dialog: save_app_state_variable app_name variable value
python with dialog: kano.profile.badges save_app_state_variable_with_dialog(app_name, variable, value)
python without dialog: kano.profile.apps save_app_state_variable(app_name, variable, value)
saves value to app's variable
cli with dialog: increment_app_state_variable app_name variable value
python with dialog: kano.profile.badges increment_app_state_variable_with_dialog(app_name, variable, value)
python without dialog: kano.profile.apps increment_app_state_variable(app_name, variable, value)
Increments an apps variable with the given value. If the variable has not been initialised it starts from 0.
cli: unlock, lock
python: kano.profile.profile set_unlocked(True/False)
Unlocks/locks the profile.
cli: is_registered
python: kano.world.functions is_registered()
Returns whether the user has registered on kano-world.
cli: has_token
python: kano.world.functions has_token()
Returns whether the user is logged in to kano-world.
cli: get_username
python: kano.world.functions get_mixed_username()
Returns the kano-world username if the user is registered, linux username otherwise.
cli: get_level
python: kano.profile.badges calculate_kano_level()
Returns the user's kano-level (cli), or (kano-level, progress) tuple (Python).
cli: get_xp
python: kano.profile.badges calculate_xp()
Returns the user's xp.
cli: get_avatar
// to be implemented
Returns the user's avatar in 'avatar_category avatar' format (cli)
cli: get_stats
Prints is_registered, get_avatar, get_xp, get_level, get_username, has_token in one function.
cli: get_app_data_dir app_name
python: kano.profile.apps get_app_data_dir(app_name)
get the full-path of data folder of app. Not used at the moment, data is stored in ...-content folders
cli: get_email
python: kano.profile.profile load_profile()['email']
Returns the user's kano-world registered email address.
Cli:
- if email found: prints it and exits 0
- if email not found: prints error message and exits 1
Python:
You should check if 'email' in profile or put it in a try-except block.
kano-sync is a command line tool for syncing the kano-profile.
kano-sync always logs in and if it cannot it launches the login-dialog. By adding -s you make it silently fail.
--sync does the profile data sync. This is small amount of data stored in JSON files and can be synced frequently.
--backup backs up the users content folders. The folders folders are specified in the rules/app_profiles.json file
--restore restores the users content folders. The folders folders are specified in the rules/app_profiles.json file.
Note: restore does not overwrite existing files.
// will be merged with kano-profile-cli in the future
Removes all profile information.
Login or register
Deletes all shares of the user.
Deletes all shares of the user.