Steam API (Main Entry Point)

steampak.SteamApi

alias of Api

class steampak.libsteam.resources.main.Api(library_path, app_id=None)

Main entry point of Steam API.

It is aliased as steampak.SteamApi.

from steampak import SteamApi

# Automatically initialize Steam API library if Steam client is running.
api = SteamApi(LIBRARY_PATH, app_id=APP_ID)

# Do not forget to shutdown when done:
api.shutdown()
Parameters:
  • library_path (str) – Full path to Steam library file. The library should be provided with your game. Library for various OS is distributed with Steam SDK available for Steam partners at https://partner.steamgames.com/
  • app_id (str|int) – Application (game) identifier. Pass it as a parameter or put steam_appid.txt file with that ID in your game folder.
app_id

Application ID of the current process.

apps = <steampak.libsteam.resources.apps.Applications object>

Interface to applications (games).

for app_id, app in api.apps.installed():
    print('%s: %s' % (app_id, app.name))
current_user = <steampak.libsteam.resources.user.CurrentUser object>

Interface to current user.

print(api.current_user.name)
friends = <steampak.libsteam.resources.friends.Friends object>

Interface to friends of current user.

for user in api.friends():
    print(user.name)
groups = <steampak.libsteam.resources.groups.Groups object>

Interface to user groups.

for group in api.groups():
    print(group.name)
init(app_id=None)

Initializes Steam API library.

Parameters:app_id (str|int) – Application ID.
Raises:SteamApiStartupError
install_path

Returns library installation path.

Return type:str
overlay = <steampak.libsteam.resources.overlay.Overlay object>

Interface to Steam overlay.

Overlay-related functions only work with OpenGL/D3D applications and only if Steam API is initialized before renderer device.

api.overlay.activate()
classmethod set_app_id(app_id)

Sets current application ID into environment.

Parameters:app_id (str|int) – Your application ID.
shutdown()

Shutdowns API.

start_app()

Detects if your executable was launched through the Steam client, and restarts your game through the client if necessary. The Steam client will be started if it is not running.

SDK Note: This function should be used only if you are using CEG or not using Steam’s DRM. Once applied to your executable, Steam’s DRM will handle restarting through Steam if necessary.

Return type:bool
Returns:True if your executable was NOT launched through the Steam client. This function will then start your application through the client. Your current process should exit.

False if your executable was started through the Steam client or a steam_appid.txt file is present in your game’s directory (for development). Your current process should continue.

steam_running

True if a local Steam client is running

Return type:bool
utils = <steampak.libsteam.resources.utils.Utils object>

Interface to various utilities.

print(api.utils.ui_language)