Skip to content

Commit 49f2575

Browse files
committed
fix: pass ProductAccount enum but use name property in header construction
1 parent 9f35643 commit 49f2575

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

‎samples/audiences/create_user_list.py‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,15 @@ def main(
9696
headers.append(
9797
(
9898
"login-account",
99-
f"accountTypes/{login_account_type}/accounts/{login_account_id}",
99+
f"accountTypes/{login_account_type.name}/accounts/{login_account_id}",
100100
)
101101
)
102102

103103
if linked_account_id:
104104
headers.append(
105105
(
106106
"linked-account",
107-
f"accountTypes/{linked_account_type}/accounts/{linked_account_id}",
107+
f"accountTypes/{linked_account_type.name}/accounts/{linked_account_id}",
108108
)
109109
)
110110

@@ -173,7 +173,7 @@ def main(
173173

174174
# Builds the request targeting the parent operating account.
175175
request = datamanager_v1.CreateUserListRequest(
176-
parent=f"accountTypes/{operating_account_type}/accounts/{operating_account_id}",
176+
parent=f"accountTypes/{operating_account_type.name}/accounts/{operating_account_id}",
177177
user_list=user_list,
178178
# Sets validate_only. If true, then the Data Manager API only
179179
# validates the request but doesn't apply changes.
@@ -270,13 +270,21 @@ def main(
270270
args = parser.parse_args()
271271

272272
main(
273-
args.operating_account_type,
273+
datamanager_v1.ProductAccount.AccountType[args.operating_account_type],
274274
args.operating_account_id,
275275
args.validate_only == "true",
276276
datamanager_v1.IngestedUserListInfo.UploadKeyType[args.upload_key_type],
277-
args.login_account_type,
277+
(
278+
datamanager_v1.ProductAccount.AccountType[args.login_account_type]
279+
if args.login_account_type
280+
else None
281+
),
278282
args.login_account_id,
279-
args.linked_account_type,
283+
(
284+
datamanager_v1.ProductAccount.AccountType[args.linked_account_type]
285+
if args.linked_account_type
286+
else None
287+
),
280288
args.linked_account_id,
281289
(
282290
datamanager_v1.MobileIdInfo.KeySpace[args.key_space]

0 commit comments

Comments
 (0)