Skip to content

Commit 330ba49

Browse files
authored
Merge pull request #25 from IABTechLab/ccm-UID2-2921-fix-readme-to-point-to-unifiedid.com
UID2-2921 Fix Python SDK readme to point to unifiedid.com instead
2 parents dfae343 + 9e39fc9 commit 330ba49

File tree

1 file changed

+2
-93
lines changed

1 file changed

+2
-93
lines changed

README.md

Lines changed: 2 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -30,100 +30,9 @@ The SDK can be installed using pip.
3030
pip install uid2-client
3131
```
3232

33-
## Usage for DSPs
33+
## Usage
3434

35-
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:
36-
For examples of usage for DSPs, see [sample_client.py](examples/sample_client.py) and [sample_auto_refresh.py](examples/sample_auto_refresh.py)
37-
```
38-
from uid2_client import Uid2ClientFactory
39-
40-
# for UID2 (for EUID use EuidClientFactory)
41-
client = Uid2ClientFactory.create('https://prod.uidapi.com', 'my-auth-token', 'my-secret-key')
42-
client.refresh_keys()
43-
advertising_token = 'AgAAAANRdREk+IWqqnQkZ2rZdK0TgSUP/owLryysSkUGZJT+Gy551L1WJMAZA/G2B1UMDQ20WAqwwTu6o9TexWyux0lg0HHIbmJjN6IYwo+42KC8ugaR+PX0y18qQ+3yzkxmJ/ee//4IGu/1Yq4AmO4ArXN6CeszPTxByTkysVqyQVNY2A=='
44-
decrypted_token = client.decrypt(advertising_token)
45-
print(decrypted_token.uid2)
46-
```
47-
48-
## Usage for Publishers
49-
50-
1. Create an instance of Uid2PublisherClient
51-
52-
`client = Uid2PublisherClient(UID2_BASE_URL, UID2_API_KEY, UID2_SECRET_KEY)`
53-
54-
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:
55-
56-
`token_generate_response = client.generate_token(TokenGenerateInput.from_email(emailAddress).do_not_generate_tokens_for_opted_out())`
57-
58-
>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.
59-
60-
>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.
61-
62-
### Standard Integration
63-
64-
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:
65-
66-
* 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:
67-
68-
`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.
69-
70-
### Server-Only Integration
71-
72-
If you're using server-only integration (see [Publisher Integration Guide, Server-Only](https://unifiedid.com/docs/guides/custom-publisher-integration)):
73-
74-
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.
75-
2. To retrieve the user's UID2 token, use:
76-
77-
```
78-
identity = token_generate_response.get_identity()
79-
if identity:
80-
advertising_token = identity.get_advertising_token()
81-
```
82-
4. When the user accesses another page, or on a timer, determine whether a refresh is needed:
83-
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:
84-
85-
`identity = IdentityTokens.from_json_string(identityJsonString)`
86-
2. Determine if the identity can be refreshed (that is, the refresh token hasn't expired):
87-
88-
`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) `
89-
3. Determine if a refresh is needed:
90-
91-
`if identity.is_due_for_refresh()):`
92-
5. If needed, refresh the token and associated values:
93-
94-
`token_refresh_response = client.refresh_token(identity)`
95-
96-
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.
97-
98-
99-
100-
## Usage for Sharers
101-
102-
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.
103-
For examples of usage, see [sample_sharing.py](examples/sample_sharing.py) and [sample_auto_refresh.py](examples/sample_auto_refresh.py)
104-
105-
```
106-
from uid2_client import Uid2ClientFactory
107-
108-
# for UID2 (for EUID use EuidClientFactory)
109-
client = Uid2ClientFactory.create('https://prod.uidapi.com', 'my-auth-token', 'my-secret-key')
110-
client.refresh_keys()
111-
```
112-
Senders:
113-
114-
1. Call the following:
115-
```
116-
encrypted = client.encrypt(raw_uid)
117-
```
118-
2. If encryption was successful, send the token `encrypted.uid2` to the receiver.
119-
120-
Receivers:
121-
122-
1. Call the following:
123-
```
124-
decrypted = client.decrypt(uid_token)
125-
```
126-
2. If decryption was successful, use the token `decrypted.uid2`.
35+
For documentation on usage, see the [UID2 SDK for Python Reference Guide](https://unifiedid.com/docs/sdks/uid2-sdk-ref-python).
12736

12837
## Development
12938

0 commit comments

Comments
 (0)