Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ print(decrypted_token.uid2)

>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.

>`do_not_generate_tokens_for_opted_out()` applies `policy=1` in the [/token/generate](https://unifiedid.com/docs/endpoints/post-token-generate#token-generation-policy) call. Without this, `policy` is omitted to maintain backwards compatibility.
>`do_not_generate_tokens_for_opted_out()` applies `optout_check=1` in the [/token/generate](https://unifiedid.com/docs/endpoints/post-token-generate) call. Without this, `optout_check` is omitted to maintain backwards compatibility.

### Standard Integration

Expand Down Expand Up @@ -175,3 +175,6 @@ make example_auto_refresh BASE_URL=https://prod.uidapi.com AUTH_KEY=my-auth-key
### 2.2.0 (07/26/2023)
* Added support for /token/generate
* Added support for /token/refresh

### 2.3.0 (10/11/2023)
* Update from deprecated "policy" parameter to "optout_check" parameter
2 changes: 2 additions & 0 deletions tests/test_publisher_client.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import json
import os
import unittest

Expand Down Expand Up @@ -56,6 +57,7 @@ def test_integration_optout_generate_token(self):
publisher_client = Uid2PublisherClient(self.EUID_BASE_URL, self.EUID_API_KEY, self.EUID_SECRET_KEY)
tc_string = "CPhJRpMPhJRpMABAMBFRACBoALAAAEJAAIYgAKwAQAKgArABAAqAAA"
input = TokenGenerateInput.from_email("optout@example.com").do_not_generate_tokens_for_opted_out().with_transparency_and_consent_string(tc_string)
self.assertEqual(1, json.loads(input.get_as_json_string())['optout_check'])
token_generate_response = publisher_client.generate_token(input)
self.assertTrue(token_generate_response.is_optout())
self.assertFalse(token_generate_response.is_success())
Expand Down
2 changes: 1 addition & 1 deletion uid2_client/token_generate_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def _create_json_request_for_generate_token(property, value, tc_string, generate
if tc_string is not None:
json_object["tcf_consent_string"] = tc_string
if not generate_for_opted_out:
json_object["policy"] = 1
json_object["optout_check"] = 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a unit test for this change ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A test exists at test_publisher_client#test_integration_optout_generate_token that will make sure it stil works after this change.

return json.dumps(json_object)

def create_hashed_json_request_for_generate_token(self):
Expand Down