UID2 sdk for the UID2 and EUID apis
Project description
Uid2 Client Python
The UID 2 Project is subject to Tech Lab IPR’s Policy and is managed by the IAB Tech Lab Addressability Working Group and Privacy & Rearc Commit Group. Please review the governance rules here
Client SDK for working with UID2 services.
SDK supports Python 3.6 and above.
Quick Start
Connect to the UID2 service, refresh encryption keys and use those to decrypt an advertising ID from an advertising token:
from uid2_client import Uid2Client, decrypt_token
client = Uid2Client('https://prod.uidapi.com', 'my-auth-token', 'my-secret-key')
keys = client.refresh_keys()
advertising_token = 'AgAAAANRdREk+IWqqnQkZ2rZdK0TgSUP/owLryysSkUGZJT+Gy551L1WJMAZA/G2B1UMDQ20WAqwwTu6o9TexWyux0lg0HHIbmJjN6IYwo+42KC8ugaR+PX0y18qQ+3yzkxmJ/ee//4IGu/1Yq4AmO4ArXN6CeszPTxByTkysVqyQVNY2A=='
decrypted_token = decrypt_token(advertising_token, keys)
print(decrypted_token.uid2)
More examples can be found in the [examples] directory.
Development
Required for all subsequent commands, build docker image with Python 3.6 and all dev dependencies:
make docker
Run unit tests:
make test
Build a bdist wheel:
make wheel
Get access to interactive shell within the Python 3.6 docker image:
make shell
Run all the example applications:
make examples BASE_URL=https://prod.uidapi.com AUTH_KEY=my-auth-key SECRET_KEY=my-secret-key \
AD_TOKEN=AgAAAANRdREk+IWqqnQkZ2rZdK0TgSUP/owLryysSkUGZJT+Gy551L1WJMAZA/G2B1UMDQ20WAqwwTu6o9TexWyux0lg0HHIbmJjN6IYwo+42KC8ugaR+PX0y18qQ+3yzkxmJ/ee//4IGu/1Yq4AmO4ArXN6CeszPTxByTkysVqyQVNY2A==
Or specific examples:
make example_client BASE_URL=https://prod.uidapi.com AUTH_KEY=my-auth-key SECRET_KEY=my-secret-key \
AD_TOKEN=AgAAAANRdREk+IWqqnQkZ2rZdK0TgSUP/owLryysSkUGZJT+Gy551L1WJMAZA/G2B1UMDQ20WAqwwTu6o9TexWyux0lg0HHIbmJjN6IYwo+42KC8ugaR+PX0y18qQ+3yzkxmJ/ee//4IGu/1Yq4AmO4ArXN6CeszPTxByTkysVqyQVNY2A==
make example_auto_refresh BASE_URL=https://prod.uidapi.com AUTH_KEY=my-auth-key SECRET_KEY=my-secret-key \
AD_TOKEN=AgAAAANRdREk+IWqqnQkZ2rZdK0TgSUP/owLryysSkUGZJT+Gy551L1WJMAZA/G2B1UMDQ20WAqwwTu6o9TexWyux0lg0HHIbmJjN6IYwo+42KC8ugaR+PX0y18qQ+3yzkxmJ/ee//4IGu/1Yq4AmO4ArXN6CeszPTxByTkysVqyQVNY2A==
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for uid2_client-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c22bd3e851af309fc22ede13295f4df726caaa72b530a2ea743e7fd24fbe0481 |
|
MD5 | f9e6af519e62134b8e4e97e7fbfd0370 |
|
BLAKE2b-256 | c3dad7299d35076f3e86ab0dcf4c750ba049bd25a8bffc772f452a0a8f407b8d |