I have this simple script to attempt to update an exception that is marked as Deleted/Recalled and can not figure out for the life of me what i am doing wrong? Any help is greatly appreciated!
import os
import requests
from requests.auth import HTTPBasicAuth
from dotenv import load_dotenv
# Load environment variables from .env file
load_dotenv()
USERNAME = os.getenv("API_USERNAME")
PASSWORD = os.getenv("API_PASSWORD")
BASE_URL = os.getenv("BASE_URL")
requests.packages.urllib3.disable_warnings()
def update_vulnerability_exception(
base_url, exception_id, status, username, password
):
url = f"{BASE_URL}/vulnerability_exceptions/{exception_id}/{status}"
headers = {"Content-Type": "application/json"}
response = requests.post(
url,
headers=headers,
auth=HTTPBasicAuth(username, password),
verify=False,
)
return response
exception_id = 3
status = "approve"
username = USERNAME
password = PASSWORD
response = update_vulnerability_exception(
BASE_URL, exception_id, status, username, password
)
response.text
Produces this error.
'{\r\n "status" : 400,\r\n "message" : "One or more arguments supplied in the request is invalid.",\r\n "links" : [ {\r\n "href" : "{BASE_URL_REMOVED_FOR_SECURITY}:3780/api/3/vulnerability_exceptions/3/approve",\r\n "rel" : "self"\r\n } ]\r\n}'
Anyone have an example in any language (python,powershel, etc) that I can reference?