Skip to main content

Python SDK Getting Started Guide

Last updated on

Overview

You can use AccelByte Cloud's Python SDK to implement our backend services within your game. The SDK acts as a bridge between your game and our services. Follow the tutorials below to learn how to set up our Cloud Python SDK.

Prerequisites

Additional Resources

Tutorials

Install the AccelByte Python SDK

You can install the SDK with pip directly from the GitHub repository, as seen below:

pip install git+ssh://git@github.com/AccelByte/accelbyte-python-sdk.git@master#egg=accelbyte_py_sdk

Log in as a Client using the SDK

To log in as the client you created earlier, import the accelbyte_py_sdk, MyConfigRepository, and list the client's Base URL, Client ID, Client Secret, and Namespace.

Next, initialize the python SDK and call token_grant_v3 with the grant type set as "client_credentials".

import accelbyte_py_sdk
from accelbyte_py_sdk.core import MyConfigRepository
from accelbyte_py_sdk.api.iam import token_grant_v3

config = MyConfigRepository(
base_url="<your-base-url>",
client_id="<your-client-id>",
client_secret="<your-client-secret>",
namespace="<your-namespace>",
)

accelbyte_py_sdk.initialize(
options={
"config":config,
},
)

_, error = token_grant_v3(grant_type="client_credentials")
if error:
print(error)
NOTE

You can also paste in a configuration by replacing MyConfigRepository(...) with one of the following values:

  • If your configuration data is in a JSON file, replace it with JsonFileConfigRepository("path/to/the/config/file.json")
  • If your configuration data is set as Environment Variables (AB_BASE_URL, AB_CLIENT_ID, AB_CLIENT_SECRET, AB_NAMESPACE, etc.), replace it with EnvironmentConfigRepository(...)

Import AccelByte Services

Now you can start using any of the following AccelByte Cloud services in your application, by importing the following syntax to your code. See the model for each service below or in the how-to folder inside the accelbyte-python-sdk repository.

SDK Examples

See our Python SDK example repo for a selection of test cases you can use to customize your game.

IAM

from accel_py_sdk.api.iam import *
from accelbyte_py_sdk.services.auth import *

See the Authorization and Authentication documentation to learn how to connect custom services to IAM service using the Golang server-side SDK.

Basic

from accel_py_sdk.api.basic import *

See the Profile documentation to learn how to connect custom services to Basic services using the Golang server-side SDK.

Social

from accel_py_sdk.api.social import *

See the Statistics documentation to learn how to connect custom services to Social services using the Golang server-side SDK.

Platform

from accel_py_sdk.api.platform import *

See the Catalog documentation to learn how to connect custom services to Store service using the Golang server-side SDK.

Group

from accel_py_sdk.api.group import *

See the Group documentation to learn how to connect custom services to Group service using the Golang server-side SDK.

Cloud Save

from accel_py_sdk.api.cloudsave import *

See the Cloud Save documentation to learn how to connect custom services to Cloud Save service using the Golang server-side SDK.

DSM Controller

from accel_py_sdk.api.dsm_controller import *

See the Matchmaking with Dedicated Server documentation to learn how to connect custom services to DSM Controller service using the Golang server-side SDK.

Session Browser

from accel_py_sdk.api.session_browser import *

See the Matchmaking with Dedicated Server documentation to learn how to connect custom services to Session Browser service using the Golang server-side SDK.

Lobby

from accel_py_sdk.api.lobby import *

See the Notifications documentation to learn how to connect custom services to Lobby service using the Golang server-side SDK.

Telemetry

from accel_py_sdk.api.amalgam_game_telemetry import *

See the Telemetry documentation to learn how to connect custom services to Telemetry service using the Golang server-side SDK.

  • Once you've set up the Cloud Python SDK, start building your first matchmaking app using AWS SAM.