SDK for Python Reference Guide
You can use the SDK for Python on the server side to facilitate the process of generating or establishing client identity using EUID, retrieving advertising tokens for bidstream use, and automatically refreshing EUID tokens. If you have the applicable permissions, you can also decrypt EUID tokens to access the raw EUID, map personal data to raw EUIDs, and monitor rotated salt buckets.
This SDK is valid for UID2 and EUID. Some of the code naming and URLs are labelled as UID2. These apply equally to EUID.
Functionality
This SDK simplifies integration with EUID for any DSPs who are using Python for their server-side coding. The following table shows the functions it supports.
Encrypt Raw EUID to EUID Token | Decrypt EUID Token to Raw EUID | Generate EUID Token from Personal Data | Refresh EUID Token | Map Personal Data to Raw EUIDs | Monitor Rotated Salt Buckets |
---|---|---|---|---|---|
✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
API Permissions
To use this SDK, you'll need to complete the EUID account setup by following the steps described in the Account Setup page.
You'll be granted permission to use specific functions offered by the SDK, and given credentials for that access. Bear in mind that there might be functions in the SDK that you don't have permission to use. For example, publishers get a specific API permission to generate and refresh tokens, but the SDK might support other activities that require a different API permission.
For details, see API Permissions.
Version
The SDK supports Python 3.6 and above.
GitHub Repository/Package
This SDK is in the following open-source GitHub repository:
-
NOTE: This SDK is valid for both UID2 and EUID. The SDK, and some of its technical components, are named UID2, but are equally applicable for EUID.
The package is published in this location:
Installation
You can use the Pip package manager to install the SDK.
pip install uid2-client
Initialization
The initialization step depends on the role, as shown in the following table.
Role | Create Instance of Class | Link to Instructions |
---|---|---|
Publisher | Uid2PublisherClient | Usage for Publishers |
Advertiser/Data Provider | IdentityMapClient | Usage for Advertisers/Data Providers |
DSP | BidstreamClient | Usage for DSPs |
Sharer (not currently supported for EUID) | SharingClient | Not applicable |
You will need to provide the values necessary for the SDK to authenticate with the EUID service.
Parameter | Description |
---|---|
base_url | The endpoint for the EUID service. See Environments. |
auth_key | The API key. See EUID Credentials. |
secret_key | The client secret. See EUID Credentials. |
Interface
The BidstreamClient
class allows you to decrypt EUID tokens into raw EUIDs.
For details on the bidding logic for handling user opt-outs, see DSP Integration Guide.
When you use an SDK, you do not need to store or manage decryption keys.