From 9e39fc91bb510422c65f0e9ab7eaf4a1ad97d841 Mon Sep 17 00:00:00 2001 From: Caroline6312 Date: Fri, 8 Mar 2024 13:07:11 -0800 Subject: [PATCH] Fix Python SDK readme to point to unifiedid.com instead --- README.md | 95 ++----------------------------------------------------- 1 file changed, 2 insertions(+), 93 deletions(-) diff --git a/README.md b/README.md index 514414f..ed7760e 100644 --- a/README.md +++ b/README.md @@ -30,100 +30,9 @@ The SDK can be installed using pip. pip install uid2-client ``` -## Usage for DSPs +## Usage -Connect to the UID2 service, refresh the encryption keys, and then use the keys to decrypt an advertising token, to arrive at the corresponding advertising ID: -For examples of usage for DSPs, see [sample_client.py](examples/sample_client.py) and [sample_auto_refresh.py](examples/sample_auto_refresh.py) -``` -from uid2_client import Uid2ClientFactory - -# for UID2 (for EUID use EuidClientFactory) -client = Uid2ClientFactory.create('https://prod.uidapi.com', 'my-auth-token', 'my-secret-key') -client.refresh_keys() -advertising_token = 'AgAAAANRdREk+IWqqnQkZ2rZdK0TgSUP/owLryysSkUGZJT+Gy551L1WJMAZA/G2B1UMDQ20WAqwwTu6o9TexWyux0lg0HHIbmJjN6IYwo+42KC8ugaR+PX0y18qQ+3yzkxmJ/ee//4IGu/1Yq4AmO4ArXN6CeszPTxByTkysVqyQVNY2A==' -decrypted_token = client.decrypt(advertising_token) -print(decrypted_token.uid2) -``` - -## Usage for Publishers - -1. Create an instance of Uid2PublisherClient - - `client = Uid2PublisherClient(UID2_BASE_URL, UID2_API_KEY, UID2_SECRET_KEY)` - -2. Call a function that takes the user's email address or phone number as input and generates a `TokenGenerateResponse` object. The following example uses an email address: - - `token_generate_response = client.generate_token(TokenGenerateInput.from_email(emailAddress).do_not_generate_tokens_for_opted_out())` - - >IMPORTANT: Be sure to call this function only when you have obtained legal basis to convert the user’s [directly identifying information (DII)](https://unifiedid.com/docs/ref-info/glossary-uid#gl-dii) to UID2 tokens for targeted advertising. - - >IMPORTANT: Always apply `do_not_generate_tokens_for_opted_out()`. This applies `policy=1` in the [/token/generate](https://unifiedid.com/docs/endpoints/post-token-generate#token-generation-policy) call. Support for `policy=0` will be removed soon. - -### Standard Integration - -If you're using standard integration (client and server) (see [UID2 SDK for JavaScript Integration Guide](https://unifiedid.com/docs/guides/integration-javascript-server-side)), follow this step: - -* Send this identity as a JSON string back to the client (to use in the [identity field](https://unifiedid.com/docs/sdks/client-side-identity#initopts-object-void)) using the following: - - `token_generate_response.get_identity_json_string()` //Note: this method returns `None` if the user has opted out, so be sure to handle that case. - -### Server-Only Integration - -If you're using server-only integration (see [Publisher Integration Guide, Server-Only](https://unifiedid.com/docs/guides/custom-publisher-integration)): - -1. Store this identity as a JSON string in the user's session, using the `token_generate_response.get_identity_json_string()` function. This method returns `None` if the user has opted out, so be sure to handle that case. -2. To retrieve the user's UID2 token, use: - - ``` - identity = token_generate_response.get_identity() - if identity: - advertising_token = identity.get_advertising_token() - ``` -4. When the user accesses another page, or on a timer, determine whether a refresh is needed: - 1. Retrieve the identity JSON string from the user's session, and then call the following function that takes the identity information as input and generates an `IdentityTokens` object: - - `identity = IdentityTokens.from_json_string(identityJsonString)` - 2. Determine if the identity can be refreshed (that is, the refresh token hasn't expired): - - `if not identity or not identity.is_refreshable(): # we must no longer use this identity (for example, remove this identity from the user's session) ` - 3. Determine if a refresh is needed: - - `if identity.is_due_for_refresh()):` -5. If needed, refresh the token and associated values: - - `token_refresh_response = client.refresh_token(identity)` - -6. Store `token_refresh_response.get_identity_json_string()` in the user's session. If the user has opted out, this method returns `None`, indicating that the user's identity should be removed from the session. To confirm optout, you can use the `token_refresh_response.is_optout()` function. - - - -## Usage for Sharers - -A UID2 sharer is a participant that wants to share UID2s or EUIDs with another participant. Raw UID2s must be encrypted into UID2 tokens before sending them to another participant. -For examples of usage, see [sample_sharing.py](examples/sample_sharing.py) and [sample_auto_refresh.py](examples/sample_auto_refresh.py) - -``` -from uid2_client import Uid2ClientFactory - -# for UID2 (for EUID use EuidClientFactory) -client = Uid2ClientFactory.create('https://prod.uidapi.com', 'my-auth-token', 'my-secret-key') -client.refresh_keys() -``` -Senders: - -1. Call the following: -``` -encrypted = client.encrypt(raw_uid) - ``` -2. If encryption was successful, send the token `encrypted.uid2` to the receiver. - -Receivers: - -1. Call the following: -``` -decrypted = client.decrypt(uid_token) -``` -2. If decryption was successful, use the token `decrypted.uid2`. +For documentation on usage, see the [UID2 SDK for Python Reference Guide](https://unifiedid.com/docs/sdks/uid2-sdk-ref-python). ## Development