admin-dashboard-backend/groupTasks/groups/shx-manual-fetch-product-pi.../script.py

23 lines
822 B
Python

import sys
import os
import requests
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "../..")))
from libs.utils import utils
# load data from secrets
secrets = utils.get_secrets()
try:
res = requests.get("https://devdash.ex.umbach.dev/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:
sys.exit(f"HTTP error occurred: {http_err}") # HTTP error
except requests.exceptions.RequestException as err:
sys.exit(f"Error occurred: {err}") # Other errors
except Exception as e:
sys.exit(f"An unexpected error occurred: {e}")
print(f"Response text: {res.text}")