change to secrets

main
alex 2024-07-24 14:34:58 +02:00
parent 4868faba72
commit 604fffdd2d
2 changed files with 7 additions and 5 deletions

View File

@ -10,7 +10,7 @@ from libs.utils import utils
secrets = utils.get_secrets() secrets = utils.get_secrets()
try: 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"]}) 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 res.raise_for_status() # Raises a HTTPError if the HTTP request returned an unsuccessful status code
except requests.exceptions.HTTPError as http_err: except requests.exceptions.HTTPError as http_err:

View File

@ -16,6 +16,8 @@ from libs.utils import utils
# load data from secrets # load data from secrets
secrets = utils.get_secrets() secrets = utils.get_secrets()
crm_endpoint_url = secrets['admin_dashboard']['url'] + "/api/v1/crm"
headers = { headers = {
"X-Api-Key": secrets["admin_dashboard"]["x_api_key"], "X-Api-Key": secrets["admin_dashboard"]["x_api_key"],
"Content-Type": "application/json" "Content-Type": "application/json"
@ -48,7 +50,7 @@ discountCode = None
def CreateCrmCustomer(): def CreateCrmCustomer():
response = requests.post( response = requests.post(
url=f"{secrets['admin_dashboard']['crm_endpoint_url']}/customer/create", url=f"{crm_endpoint_url}/customer/create",
headers=headers, headers=headers,
json={ json={
"FirstName": customerName, "FirstName": customerName,
@ -83,7 +85,7 @@ def CheckIfCrmCustomerExists():
print(f"Checking if customer exists: {customerEmail}") print(f"Checking if customer exists: {customerEmail}")
response = requests.post( response = requests.post(
url=f"{secrets['admin_dashboard']['crm_endpoint_url']}/customer", url=f"{crm_endpoint_url}/customer",
headers=headers, headers=headers,
json={"Email": customerEmail} # Hier json verwenden, um JSON-Daten zu senden json={"Email": customerEmail} # Hier json verwenden, um JSON-Daten zu senden
) )
@ -163,7 +165,7 @@ def CreateCrmActivityLink(customerId, thirdVoucher):
def req(type, url): def req(type, url):
response = requests.post( response = requests.post(
url=f"{secrets['admin_dashboard']['crm_endpoint_url']}/links", url=f"{crm_endpoint_url}/links",
headers=headers, headers=headers,
json={ json={
"CustomerId": customerId, "CustomerId": customerId,
@ -188,7 +190,7 @@ def CreateCrmActivityLink(customerId, thirdVoucher):
def GetCustomerActivityLinks(customerId, thirdVoucher): def GetCustomerActivityLinks(customerId, thirdVoucher):
response = requests.get( response = requests.get(
url=f"{secrets['admin_dashboard']['crm_endpoint_url']}/customer/view/{customerId}", url=f"{crm_endpoint_url}/customer/view/{customerId}",
headers=headers, headers=headers,
) )