Access
Connect cross-platform accounts & identity management
You can use the AccelByte 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 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
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 configuration by replacing MyConfigRepository(...) with the following value.
Now you can start using any of the following AccelByte services in your application, by importing the following syntax to your code. See the model for each service below or in the how-to (opens new window) folder inside the accelbyte-python-sdk (opens new window) repository.
See our Python SDK example repo (opens new window) for a selection of test cases you can use to customize your game.
SDK reference (opens new window)
from accel_py_sdk.api.iam import *
from accelbyte_py_sdk.services.auth import *