Skip to content

Client configuration

This page shows you how to configure the Fanpoints Python SDK.

Generating access tokens

To access the Fanpoints API, you first need to generate access tokens. Go to the admin panel, navigate to your Marketing Partner, click on Einstellungen and then on API-Tokens. You can generate a new token there. Each token consists of a client id and a secret.

Configuring a client

Every operation is performed on a FanpointsClient object. You can create a new client using the following snippet:

from fanpoints_python import FanpointsClient
client = FanpointsClient(
partner_id='<your partner id>',
client_id='<your client id>',
secret='<your client secret>',
)

Your partner_id can be found in the admin panel (Einstellungen and then Partner-ID).

Testing your configuration

Use the ping function to test if the client is properly configured:

import asyncio
from fanpoints_python import FanpointsClient
client = FanpointsClient(
partner_id='<your partner id>',
client_id='<your client id>',
secret='<your client secret>',
)
result = asyncio.run(client.ping())
print(result)
# should print "ping='pong'"

Accessing the SDK features

All operations are available on the different modules of the SDK. Currently, the following modules are available:

from fanpoints_python import FanpointsClient
client = FanpointsClient(
partner_id='<your partner id>',
client_id='<your client id>',
secret='<your client secret>',
)
# contains all operations related to users
users_module = client.users
# contains all operations related to making and managing conversions
conversion_module = client.conversion

Return types

All return values are either primitive types or pydantic models. This means that all return values are fully typed.