Skip to content

Commit 75d759e

Browse files
committed
Address comments
1 parent 3a9e2de commit 75d759e

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

examples/sample_identity_map_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# which contains raw uid or the reason why it is unmapped
88

99
def _usage():
10-
print('Usage: python3 sample_sharing_client.py <base_url> <auth_key> <secret_key> <email_1> <email_2> ... <email_n>'
10+
print('Usage: python3 sample_sharing_client.py <base_url> <api_key> <client_secret> <email_1> <email_2> ... <email_n>'
1111
, file=sys.stderr)
1212
sys.exit(1)
1313

@@ -16,12 +16,12 @@ def _usage():
1616
_usage()
1717

1818
base_url = sys.argv[1]
19-
auth_key = sys.argv[2]
20-
secret_key = sys.argv[3]
19+
api_key = sys.argv[2]
20+
client_secret = sys.argv[3]
2121
email_list = sys.argv[4:]
2222
first_email = sys.argv[4]
2323

24-
client = IdentityMapClient(base_url, auth_key, secret_key)
24+
client = IdentityMapClient(base_url, api_key, client_secret)
2525

2626
identity_map_response = client.generate_identity_map(IdentityMapInput.from_emails(email_list))
2727

@@ -30,7 +30,7 @@ def _usage():
3030

3131
mapped_identity = mapped_identities.get(first_email)
3232
if mapped_identity is not None:
33-
raw_uid = mapped_identity.get_raw_id()
33+
raw_uid = mapped_identity.get_raw_uid()
3434
print('raw_uid =', raw_uid)
3535
else:
3636
unmapped_identity = unmapped_identities.get(first_email)

tests/test_identity_map_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ def test_identity_map_duplicate_emails(self):
8686
mapped_identities = response.mapped_identities
8787
self.assertEqual(4, len(mapped_identities))
8888

89-
raw_uid = mapped_identities.get("[email protected]").get_raw_id()
90-
self.assertEqual(raw_uid, mapped_identities.get("[email protected]").get_raw_id())
91-
self.assertEqual(raw_uid, mapped_identities.get("[email protected]").get_raw_id())
92-
self.assertEqual(raw_uid, mapped_identities.get("[email protected]").get_raw_id())
89+
raw_uid = mapped_identities.get("[email protected]").get_raw_uid()
90+
self.assertEqual(raw_uid, mapped_identities.get("[email protected]").get_raw_uid())
91+
self.assertEqual(raw_uid, mapped_identities.get("[email protected]").get_raw_uid())
92+
self.assertEqual(raw_uid, mapped_identities.get("[email protected]").get_raw_uid())
9393

9494
def test_identity_map_duplicate_hashed_emails(self):
9595
hashed_email = normalize_and_hash_email("[email protected]")
@@ -154,7 +154,7 @@ def test_identity_map_bad_secret(self):
154154
def assert_mapped(self, response, ddi):
155155
mapped_identity = response.mapped_identities.get(ddi)
156156
self.assertIsNotNone(mapped_identity)
157-
self.assertIsNotNone(mapped_identity.get_raw_id())
157+
self.assertIsNotNone(mapped_identity.get_raw_uid())
158158
self.assertIsNotNone(mapped_identity.get_bucket_id())
159159

160160
unmapped_identity = response.unmapped_identities.get(ddi)

uid2_client/identity_map_client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@ class IdentityMapClient:
1717
generate_identity_map: Generate identity map
1818
"""
1919

20-
def __init__(self, base_url, auth_key, secret_key):
20+
def __init__(self, base_url, api_key, client_secret):
2121
"""Create a new IdentityMapClient client.
2222
2323
Args:
2424
base_url (str): base URL for all requests to UID services (e.g. 'https://prod.uidapi.com')
25-
auth_key (str): authorization key for consuming the UID services
26-
secret_key (str): secret key for consuming the UID services
25+
api_key (str): api key for consuming the UID services
26+
client_secret (str): client secret for consuming the UID services
2727
2828
Note:
2929
Your authorization key will determine which UID services you are allowed to use.
3030
"""
3131
self._base_url = base_url
32-
self._auth_key = auth_key
33-
self._secret_key = base64.b64decode(secret_key)
32+
self._api_key = api_key
33+
self._client_secret = base64.b64decode(client_secret)
3434

3535
def generate_identity_map(self, identity_map_input):
36-
req, nonce = make_v2_request(self._secret_key, dt.datetime.now(tz=timezone.utc),
36+
req, nonce = make_v2_request(self._client_secret, dt.datetime.now(tz=timezone.utc),
3737
identity_map_input.get_identity_map_input_as_json_string().encode())
38-
resp = post(self._base_url, '/v2/identity/map', headers=auth_headers(self._auth_key), data=req)
39-
resp_body = parse_v2_response(self._secret_key, resp.read(), nonce)
38+
resp = post(self._base_url, '/v2/identity/map', headers=auth_headers(self._api_key), data=req)
39+
resp_body = parse_v2_response(self._client_secret, resp.read(), nonce)
4040
return IdentityMapResponse(resp_body, identity_map_input)

uid2_client/identity_map_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(self, raw_uid, bucket_id):
4343
self.raw_uid = raw_uid
4444
self.bucket_id = bucket_id
4545

46-
def get_raw_id(self):
46+
def get_raw_uid(self):
4747
return self.raw_uid
4848

4949
def get_bucket_id(self):

0 commit comments

Comments
 (0)