Skip to main content

GOG Galaxy Integrations Python API

Project description

GOG GALAXY Integrations Python API

This Python library allows developers to easily build community integrations for various gaming platforms with GOG GALAXY 2.1.

Note: For integrations targeting GOG GALAXY the below 2.1.0 version, please refer to this version.

Features

Each integration in GOG GALAXY 2.1 comes as a separate Python script and is launched as a separate process that needs to communicate with the main instance of GOG GALAXY 2.1.

The provided features are:

  • multistep authorization using a browser built into GOG GALAXY 2.1
  • support for GOG GALAXY 2.1 features:
    • importing owned and detecting installed games
    • installing and launching games
    • importing achievements and game time
    • importing friends lists and statuses
    • importing friends recommendations list
    • receiving and sending chat messages
  • cache storage

Platform Id's

Each integration can implement only one platform. Each integration must declare which platform it's integrating.

List of possible Platform IDs

Basic usage

Each integration should inherit from the galaxy.api.plugin.Plugin class. Supported methods like galaxy.api.plugin.Plugin.get_owned_games should be overwritten - they are called from the GOG GALAXY client at the appropriate times. Each of those methods can raise exceptions inherited from the galaxy.api.jsonrpc.ApplicationError. Communication between an integration and the client is also possible with the use of notifications, for example: galaxy.api.plugin.Plugin.update_local_game_status.

The minimum implementation requires to override galaxy.api.plugin.Plugin.authenticate and galaxy.api.plugin.Plugin.get_owned_games methods.

import sys
from galaxy.api.plugin import Plugin, create_and_run_plugin
from galaxy.api.consts import Platform
from galaxy.api.types import Authentication, Game, LicenseInfo, LicenseType


class PluginExample(Plugin):
    def __init__(self, reader, writer, token):
        super().__init__(
            Platform.Test,  # choose platform from available list
            "0.1",  # version
            reader,
            writer,
            token
        )

    # implement methods

    # required
    async def authenticate(self, stored_credentials=None):
        return Authentication('test_user_id', 'Test User Name')

    # required
    async def get_owned_games(self):
        return [
            Game('test', 'The Test', None, LicenseInfo(LicenseType.SinglePurchase))
        ]


def main():
    create_and_run_plugin(PluginExample, sys.argv)

# run plugin event loop
if __name__ == "__main__":
    main()

Deployment

The client has a built-in Python 3.13 interpreter, so integrations are delivered as Python modules. In order to be found by GOG GALAXY 2.1 an integration folder should be placed in lookup directory. Beside all the Python files, the integration folder must contain manifest.json and all third-party dependencies. See an exemplary structure.

Lookup directory

  • Windows:

    %localappdata%\GOG.com\Galaxy\plugins\installed

  • macOS:

    ~/Library/Application Support/GOG.com/Galaxy/plugins/installed

Logging

Root logger is already setup by GOG GALAXY to store rotated log files in:

  • Windows:

    %programdata%\GOG.com\Galaxy\logs

  • macOS:

    /Users/Shared/GOG.com/Galaxy/Logs

Plugin logs are kept in plugin-<platform>-<guid>.log. When debugging, inspecting the other side of communication in the GalaxyClient.log can be helpful as well.

Manifest

Obligatory JSON file to be placed in an integration folder.

{
    "name": "Example plugin",
    "platform": "test",
    "guid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
    "version": "0.1",
    "description": "Example plugin",
    "author": "Name",
    "email": "author@email.com",
    "url": "https://github.com/user/galaxy-plugin-example",
    "script": "plugin.py"
}
property description
guid custom Globally Unique Identifier
version the same string as version in Plugin constructor
script path of the entry point module, relative to the integration folder

Dependencies

All third-party packages (packages not included in the Python 3.13 standard library) should be deployed along with plugin files. Use the following command structure:

pip install DEP --target DIR --implementation cp --python-version 313

For example, a plugin that uses requests could have the following structure:

installed
└── my_integration
    ├── galaxy
       └── api
    ├── requests
       └── ...
    ├── plugin.py
    └── manifest.json

Legal Notice

By integrating or attempting to integrate any applications or content with or into GOG GALAXY 2.1 you represent that such application or content is your original creation (other than any software made available by GOG) and/or that you have all necessary rights to grant such applicable rights to the relevant community integration to GOG and to GOG GALAXY 2.1 end users for the purpose of use of such community integration and that such community integration comply with any third party license and other requirements including compliance with applicable laws.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

galaxy_plugin_api-0.71.tar.gz (38.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

galaxy_plugin_api-0.71-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

Details for the file galaxy_plugin_api-0.71.tar.gz.

File metadata

  • Download URL: galaxy_plugin_api-0.71.tar.gz
  • Upload date:
  • Size: 38.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for galaxy_plugin_api-0.71.tar.gz
Algorithm Hash digest
SHA256 33eface84af041de052cbf7d790af55ec44ee99a656cec63166f8ca5cd389b28
MD5 58fb8d81ead485d0c3d990b5345d1145
BLAKE2b-256 a5d1a2f375ccdf88811d903403bfe7164406112ed4196f65732d96769b3519ed

See more details on using hashes here.

File details

Details for the file galaxy_plugin_api-0.71-py3-none-any.whl.

File metadata

File hashes

Hashes for galaxy_plugin_api-0.71-py3-none-any.whl
Algorithm Hash digest
SHA256 b337fa07c1ff7e286000478d5f44102898f6fba884a5031b03f650afca1be473
MD5 62abb3078710cf9546cafc72b86a80af
BLAKE2b-256 c87e3dfcc063c0b0c5d445723b24415ef5f7e458b7374c2e746d1627d3233f0f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page