From bd5010caaeb982209383341bcca18af3640247d2 Mon Sep 17 00:00:00 2001 From: "pixeebot[bot]" <104101892+pixeebot[bot]@users.noreply.github.com> Date: Sun, 10 Aug 2025 03:43:58 +0000 Subject: [PATCH] Sandbox URL Creation --- flag_cleanup.py | 8 ++++---- harness_scm.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/flag_cleanup.py b/flag_cleanup.py index ab6edcf..5a98b68 100644 --- a/flag_cleanup.py +++ b/flag_cleanup.py @@ -1,5 +1,4 @@ import os -import requests from urllib.parse import urlparse, urlunparse from github import Github from harness_scm import HarnessSCM, Repo @@ -7,6 +6,7 @@ import git import secrets import string +from security import safe_requests def generate_random_id_string(length=6): characters = string.ascii_letters + string.digits @@ -33,7 +33,7 @@ def get_flag_data(api_key, base_url, account_id, org_identifier, project_identif base_url, account_id, project_identifier, account_id, org_identifier, environment_identifier) headers = {"x-api-key": api_key} try: - response = requests.get(url, params={}, headers=headers) + response = safe_requests.get(url, params={}, headers=headers) except Exception as e: print(f"Error getting flag data: {e}") return {} @@ -50,7 +50,7 @@ def get_env(api_key, base_url, account_id, org_identifier, project_identifier): url = f"https://{base_url}/gateway/cf/admin/environments?accountIdentifier={account_id}&orgIdentifier={org_identifier}&projectIdentifier={project_identifier}" headers = {"x-api-key": api_key} try: - response = requests.get(url, params={}, headers=headers) + response = safe_requests.get(url, params={}, headers=headers) except Exception as e: print(f"Error getting environment: {e}") return env @@ -217,4 +217,4 @@ def get_repo_name_from_remote_url(url): except Exception as e: print(f"Error creating pull request: {e}") else: - raise Exception("Nothing to commit, so no Pull Request") \ No newline at end of file + raise Exception("Nothing to commit, so no Pull Request") diff --git a/harness_scm.py b/harness_scm.py index 7cddc78..6234f93 100644 --- a/harness_scm.py +++ b/harness_scm.py @@ -1,4 +1,5 @@ import requests +from security import safe_requests class HarnessSCM: @@ -15,7 +16,7 @@ def get_repo(self, repo_id, account_id, project_id, **kwargs): headers = { 'x-api-key': self.token } - response = requests.get(endpoint, headers=headers) + response = safe_requests.get(endpoint, headers=headers) if response.status_code == 200: return Repo(self.token, response.json()) else: