From 604fffdd2d2ec9d8143b320e5dac31fa564b349d Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 24 Jul 2024 14:34:58 +0200 Subject: [PATCH] change to secrets --- .../script.py | 2 +- groupTasks/groups/shx-order-voucher-codes/script.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/groupTasks/groups/shx-manual-fetch-product-pipeline-products/script.py b/groupTasks/groups/shx-manual-fetch-product-pipeline-products/script.py index 0d9fce4..c8ead74 100644 --- a/groupTasks/groups/shx-manual-fetch-product-pipeline-products/script.py +++ b/groupTasks/groups/shx-manual-fetch-product-pipeline-products/script.py @@ -10,7 +10,7 @@ from libs.utils import utils secrets = utils.get_secrets() try: - res = requests.get("https://devdash.ex.umbach.dev/api/v1/productpipeline/update", + res = requests.get(secrets["admin_dashboard"]["url"] + "/api/v1/productpipeline/update", headers={"X-Api-key": secrets["admin_dashboard"]["x_api_key"]}) res.raise_for_status() # Raises a HTTPError if the HTTP request returned an unsuccessful status code except requests.exceptions.HTTPError as http_err: diff --git a/groupTasks/groups/shx-order-voucher-codes/script.py b/groupTasks/groups/shx-order-voucher-codes/script.py index 6828b15..3d0c8a0 100644 --- a/groupTasks/groups/shx-order-voucher-codes/script.py +++ b/groupTasks/groups/shx-order-voucher-codes/script.py @@ -16,6 +16,8 @@ from libs.utils import utils # load data from secrets secrets = utils.get_secrets() +crm_endpoint_url = secrets['admin_dashboard']['url'] + "/api/v1/crm" + headers = { "X-Api-Key": secrets["admin_dashboard"]["x_api_key"], "Content-Type": "application/json" @@ -48,7 +50,7 @@ discountCode = None def CreateCrmCustomer(): response = requests.post( - url=f"{secrets['admin_dashboard']['crm_endpoint_url']}/customer/create", + url=f"{crm_endpoint_url}/customer/create", headers=headers, json={ "FirstName": customerName, @@ -83,7 +85,7 @@ def CheckIfCrmCustomerExists(): print(f"Checking if customer exists: {customerEmail}") response = requests.post( - url=f"{secrets['admin_dashboard']['crm_endpoint_url']}/customer", + url=f"{crm_endpoint_url}/customer", headers=headers, json={"Email": customerEmail} # Hier json verwenden, um JSON-Daten zu senden ) @@ -163,7 +165,7 @@ def CreateCrmActivityLink(customerId, thirdVoucher): def req(type, url): response = requests.post( - url=f"{secrets['admin_dashboard']['crm_endpoint_url']}/links", + url=f"{crm_endpoint_url}/links", headers=headers, json={ "CustomerId": customerId, @@ -188,7 +190,7 @@ def CreateCrmActivityLink(customerId, thirdVoucher): def GetCustomerActivityLinks(customerId, thirdVoucher): response = requests.get( - url=f"{secrets['admin_dashboard']['crm_endpoint_url']}/customer/view/{customerId}", + url=f"{crm_endpoint_url}/customer/view/{customerId}", headers=headers, )