Skip to content

Commit 6a46911

Browse files
Added header
1 parent 2cd4d28 commit 6a46911

File tree

3 files changed

+3
-9
lines changed

3 files changed

+3
-9
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"
77

88
[project]
99
name = "uid2_client"
10-
version = "1.0.0"
10+
version = "2.0.0"
1111
authors = [
1212
{ name = "Cody Constine", email = "cody.constine@thetradedesk.com" }
1313
]

tests/sharing_test.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,6 @@ def test_cannot_encrypt_if_no_key_from_default_keyset(self):
138138

139139
self.assertRaises(EncryptionError, encrypt_key, _example_uid, IdentityScope.UID2, keys)
140140

141-
# def test_cannot_encrypt_if_theres_no_default_keyset_header(self):
142-
# client = Uid2Client("endpoint", "authkey", _client_secret)
143-
# json_body = self._key_set_to_json_for_sharing_with_header("", 99999, [_master_key, _site_key])
144-
# keys = client.refresh_json(json_body)
145-
#
146-
# self.assertRaises(EncryptionError, encrypt_key, _example_uid, IdentityScope.UID2, keys)
147-
148141
def test_expiry_in_token_matches_expiry_in_reponse(self):
149142
client = Uid2Client("endpoint", "authkey", _client_secret)
150143
json_body = self._key_set_to_json_for_sharing_with_header('"default_keyset_id": 99999, "token_expiry_seconds": 2,', 99999, [_master_key, _site_key])

uid2_client/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import json
1212
import os
1313
import urllib.request as request
14+
import pkg_resources
1415

1516
from .keys import EncryptionKey, EncryptionKeysCollection
1617
from .encryption import _decrypt_gcm, _encrypt_gcm
@@ -93,7 +94,7 @@ def _make_url(self, path):
9394
return self._base_url + path
9495

9596
def _auth_headers(self):
96-
return {'Authorization': 'Bearer ' + self._auth_key}
97+
return {'Authorization': 'Bearer ' + self._auth_key, "X-UID2-Client-Version": pkg_resources.get_distribution("uid2_client").version}
9798

9899
def _make_v2_request(self, now):
99100
payload = int.to_bytes(int(now.timestamp() * 1000), 8, 'big')

0 commit comments

Comments
 (0)